473,698 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Return bool from query

Hi there,

I have a mySQL system with a news publishing part in it:
Admins can create new items with text in it, and they have an option to
create 'fulltexts', so you'd get "read more ..." on the front page,
click it and read the fulltext.

Is there a possibility for mySQL (query) to check if 'fulltext' is
empty or not, and only return true or false, so i don't have to put the
whole fulltext into the mysql_fetch_arr ay() to decide wether or not to
show 'read_more', or should i create an extra boolean field in the DB
saying fulltext y/n ?

Greetings Frizzle.

Feb 7 '06
25 2250
frizzle wrote:

I actually use PHPmyAdmin, but don't know where to set it to INNODB, or
my host disabled that, (i can choose form 3 other ones though ...)

Frizzle.


After you select the table, go to the Operations tab. One of the
entries is "Table type". Change this to INNODB.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Feb 9 '06 #21

Jerry Stuckle wrote:
frizzle wrote:

I actually use PHPmyAdmin, but don't know where to set it to INNODB, or
my host disabled that, (i can choose form 3 other ones though ...)

Frizzle.


After you select the table, go to the Operations tab. One of the
entries is "Table type". Change this to INNODB.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===


The only options i get there are:
- MyISAM (current)
- Heap
- ISAM
- Merge

So i guess it's not possible (yet). But i have things up and running
correct now, or do you think it's that important to go use foreign
keys?

Frizle.

Feb 9 '06 #22
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:
I actually use PHPmyAdmin, but don't know where to set it to INNODB, or
my host disabled that, (i can choose form 3 other ones though ...)

Frizzle.


After you select the table, go to the Operations tab. One of the
entries is "Table type". Change this to INNODB.
--
============= =====
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@att global.net
============= =====

The only options i get there are:
- MyISAM (current)
- Heap
- ISAM
- Merge

So i guess it's not possible (yet). But i have things up and running
correct now, or do you think it's that important to go use foreign
keys?

Frizle.


OK, you're hosting company may have an older copy of MySQL, may not have
installed INNODB support or whatever.

INNODB will allow you to ensure the integrity of your foreign keys. For
instance, if you delete a row in your main table, it can automatically
delete the matching row(s) in your full text table (other options are
available also). Without it, you can't guarantee the integrity of the
database.

So it all depends on how important it is to you. You'll probably be ok
- this isn't like a bank, for instance, where you don't want to delete a
person's record while they still have open accounts. If you have some
extra rows in your full text table it might slow the server down a
couple of milliseconds is all.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Feb 9 '06 #23

Jerry Stuckle wrote:
frizzle wrote:
Jerry Stuckle wrote:
frizzle wrote:

I actually use PHPmyAdmin, but don't know where to set it to INNODB, or
my host disabled that, (i can choose form 3 other ones though ...)

Frizzle.
After you select the table, go to the Operations tab. One of the
entries is "Table type". Change this to INNODB.
--
============= =====
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@att global.net
============= =====

The only options i get there are:
- MyISAM (current)
- Heap
- ISAM
- Merge

So i guess it's not possible (yet). But i have things up and running
correct now, or do you think it's that important to go use foreign
keys?

Frizle.


OK, you're hosting company may have an older copy of MySQL, may not have
installed INNODB support or whatever.

INNODB will allow you to ensure the integrity of your foreign keys. For
instance, if you delete a row in your main table, it can automatically
delete the matching row(s) in your full text table (other options are
available also). Without it, you can't guarantee the integrity of the
database.

So it all depends on how important it is to you. You'll probably be ok
- this isn't like a bank, for instance, where you don't want to delete a
person's record while they still have open accounts. If you have some
extra rows in your full text table it might slow the server down a
couple of milliseconds is all.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===


Ok, thanks a lot for all the effort. No more further questions ...
for now ;)

Again, thanks a lot for taking so much time!

Frizzle.

Feb 9 '06 #24
FULLTEXT() is a MySQL search function. so you might want to name your
column something else.

"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:Nf******** ************@co mcast.com...
frizzle wrote:
Hi there,

I have a mySQL system with a news publishing part in it:
Admins can create new items with text in it, and they have an option to
create 'fulltexts', so you'd get "read more ..." on the front page,
click it and read the fulltext.

Is there a possibility for mySQL (query) to check if 'fulltext' is
empty or not, and only return true or false, so i don't have to put the
whole fulltext into the mysql_fetch_arr ay() to decide wether or not to
show 'read_more', or should i create an extra boolean field in the DB
saying fulltext y/n ?

Greetings Frizzle.


Put it in a separate table with just the article's id and the text. If
the id exists in the second table, there is more text.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Feb 12 '06 #25

"frizzle" <ph********@gma il.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Hi there,

I have a mySQL system with a news publishing part in it:
Admins can create new items with text in it, and they have an option to
create 'fulltexts', so you'd get "read more ..." on the front page,
click it and read the fulltext.

Is there a possibility for mySQL (query) to check if 'fulltext' is
empty or not, and only return true or false, so i don't have to put the
whole fulltext into the mysql_fetch_arr ay() to decide wether or not to
show 'read_more', or should i create an extra boolean field in the DB
saying fulltext y/n ?

Greetings Frizzle.


if you create the column with type TEXT or LONGTEXT (or whatever) with
DEFAULT NULL, you can use MySQL's ISNULL() function to detect if it's empty
or not.
for instance,
SELECT ISNULL(fulltext 1) FROM tablename ORDER BY itemtimestamp DESC

you can in your code with $row=mysql_fetc h_array() see if $row['ISNULL']
(not sure if it should be lower case here) has an appropriate value. echo
it to find out.

Feb 12 '06 #26

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

30
2146
by: John Bailo | last post by:
The c# *return* statement has been bothering me the past few months. I don't like the fact that you can have different code paths in a method and have multiple return statements. To me, it would be more orthogonal if a method could only have one return statement. --
2
5356
by: Justin Dutoit | last post by:
Hey. I have a function with a boolean return value, called IsInWarehouse, which checks if a product is available in a warehouse, or not. But I need security in the function too, so I have public bool IsInWarehouse(string productName) { if (Login(username, password)) { // query db about available product } else {
10
19151
by: Mark Jerde | last post by:
I'm trying to learn the very basics of using an unmanaged C++ DLL from C#. This morning I thought I was getting somewhere, successfully getting back the correct answers to a C++ " int SumArray(int ray, int count)" Now I'm having problems with C++ "return(false)" being True in C#. Here is the C# code. ========================= using System; using System.Runtime.InteropServices; //
5
2065
by: Edward Diener | last post by:
I am gathering from the documentation that return values from __events are not illegal but are frowned upon in .NET. If this is the case, does one pass back values from an event handler via "in/out" or "out" parameters ? Or is it simply that events are just notifications and are not interested in any values which event handlers might be able to return ? If the latter is the case, the event model in .NET appears to have a great...
3
1916
by: Daves | last post by:
a get { ... } for public property SelectedValue returns DateTime type to be used as a parameter in a Sql update query but I'd like it to return "empty" if no date has been selected... I cannot use return null; because "Cannot convert null to 'System.DateTime' because it is a value type" How can this be done?
40
3132
by: Mark P | last post by:
I'm implementing an algorithm and the computational flow is a somewhat deep. That is, fcn A makes many calls to fcn B which makes many calls to fcn C, and so on. The return value of the outermost fcn is a boolean and there are certain places within the inner functions where it may become apparent that the return value is false. In this case I'd like to halt the computation immediately and return false. My current approach is to have...
2
27052
by: fhasdkfhadlksfjhalsdkfh12 | last post by:
I've been working on a decryption program for another encryption program I made. It isn't finished, and when I try to compile it to test it, it gives me the error "expected unqualified-id before 'return'" right at the line where "return 0;" is. I am using Xcode for mac os, which is the same as g++ 4.0 for Unix/Linux. I can't seem to figure this out, and I can't test anything until it's fixed. Any ideas? Here's the code:...
13
2904
by: cppquester | last post by:
A colleague told me that there is a rule about good stype that a function in C++ should have only one point of return (ie. return statement). Otherwise there might be trouble. I never heard about it and doubt it. Anybody heard of it? What would be the advantage? Regards, Marc Example:
6
1828
by: exander77 | last post by:
I am quite new to c++, about half of a year. I juct wonder, why such code is not possible: int chlen(char * ar) { for(int i=0;ar||return i;i++); } In my opinion, it would be much "cuter" than this: int chlen(char * ar) {
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9028
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8895
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4369
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.