How to test if mysql_fetch_array returns no results ?

From: Date: Fri, 21 Sep 2001 16:27:12 +0000
Subject: How to test if mysql_fetch_array returns no results ?
Groups: php.db 
Request: Send a blank email to php-db+get-12641@lists.php.net to get a copy of this message
I am new to PHP so I am need someone to explain this problem to me. I am trying to read items from a table and store them into an array. My current function of choice to use is "mysql_fetch_array". The documentation says that it returns FALSE if there are no more rows returned, but yet when the query does not return a result set, It does not return anything. So the basic question is how do I test for a query that does not return for any results ? Here is some of my code below: $result = mysql_db_query ("GradAdmissions","select * from applicant where applicant_id = 17"); while ($row = mysql_fetch_array ($result)) { echo "applicant_id: ".$row["applicant_id"]."<br>\n"; echo "member_id: ".$row["member_id"]."<br>\n"; } mysql_free_result ($result); Thanks in advance

« previous php.db (#12641) next »