|
Posted by Jim Michaels on 02/12/06 11:11
"frizzle" <phpfrizzle@gmail.com> wrote in message
news:1139309843.112725.157880@g14g2000cwa.googlegroups.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_array() 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(fulltext1) FROM tablename ORDER BY itemtimestamp DESC
you can in your code with $row=mysql_fetch_array() see if $row['ISNULL']
(not sure if it should be lower case here) has an appropriate value. echo
it to find out.
Navigation:
[Reply to this message]
|