try this

$result = mysql_query($sql_query);

if ($result) {
  while ($row = mysql_fetch_array($result)) {
  $var_1 = $row['var_1'];
  $var_2 = $row['var_2'];


-----Original Message-----
From: Jon Yaggie [mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 05, 2001 1:36 PM
Subject: [PHP-DB] checking for results return from mysql

i suppose this much have a simple solution i am missing.  but here is the

i want to checkand see if my query returned any results.   problem is if i
check liek this -
if($results = mysql_fetch_array($result))

it appears that a resource is returned regardless.  so this is always true.

the real problem is that i need to find out if something is returned without
actually accessing the data.  because this if statement appears to be
calling the first row of result data so later when i use a while loop to go
through the data i am missing the first result returned.

i have tried putting a few other mysql function in the conditional.  maybe i
am on the wrong path  . . would one of the cariable functions like isset()
or soemthing check this?

Thank You,

Jon Yaggie

And they were singing . . .

'100 little bugs in the code
100 bugs in the code
fix one bug, compile it again
101 little bugs in the code

101 little bugs in the code . . .'

And it continued until they reached 0

Do You Yahoo!?
Get your free address at

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to