Page 1 of 1
Feedback from a query of results found
Posted: Sun Jun 27, 2004 9:56 am
by Calimero
The Problem =
What is the code for PHP to recognize whether the query returned EMPTY SET - no results found
And if possible I would need it in IF - return(ed) empty set (), ELSE()
code.
Posted: Sun Jun 27, 2004 10:10 am
by scorphus
Sorry, we're not slave coders. Try some by yourself and call for help, we offer help voluntarily. The idea you already have, all you'll ever need is here: [php_man]mysql[/php_man].
Regards,
Scorphus.
Posted: Sun Jun 27, 2004 10:41 am
by redmonkey
PHP will have a function specific to your database that will return the numer of rows in a result set for a associated query, in the case of mysql it is
mysql_num_rows()
So you can get the number of rows and if it is greater than zero do something, else do something different.
scorphus wrote:
The idea you already have, all you'll ever need is here: [php_man]mysql[/php_man].
Assuming of course that it is a mysql database they are working with.
Posted: Sun Jun 27, 2004 11:11 am
by scorphus
Of course, if MySQL is not the DataBase server used in the case, it becomes implied that one will browse the PHP Manual and look for some information regarded to the DB server in use.
Sorry if I seemed a bit rude in that last message
Regards,
Scorphus.
Posted: Sun Jun 27, 2004 11:32 am
by redmonkey
No, I wasn't suggesting that you were rude, I know what you were getting at. I was merely commenting on the assumption being made that it was a mysql databse that was being used. While your assumption is probably correct, there is always a chance that the user may be using something else.