[thelist] something wrong with my SQL query

rudy r937 at interlog.com
Wed Nov 20 12:19:01 CST 2002


> You need to check (mysql_num_rows($result) > 0)

tom, if you just want to find out whether the category is being used,
you don't need return all the items like you're doing with this --

   SELECT item
        FROM menuitem
            WHERE categoryID =  $id

do this instead --

  SELECT count(*) as numberofitems
        FROM menuitem
            WHERE categoryID =  $id

this will always return exactly one row, so then you just test the count


rudy




More information about the thelist mailing list