Re: How to test if mysql_fetch_array returns no results ?

From: Date: Fri, 21 Sep 2001 16:41:51 +0000
Subject: Re: How to test if mysql_fetch_array returns no results ?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-12643@lists.php.net to get a copy of this message
Disregard the previous post. I figured out that mysql_num_rows() returns the number of rows from the result of a SELECT query. "Bill Blancett" <bblancett@hbu.edu> wrote in message news:20010921162755.8428.qmail@pb1.pair.com... > 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 (#12643) next »