MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Silicon Ghost Date:August 3 1999 2:48am
Subject:How to use the value from a query?
View as plain text  
I'm using PHP3 and mySQL.  

Here's my problem:

I first run a query such as:
$result = mysql_query("SELECT * FROM sites WHERE ID=1",$db);

Now I want to do a check to see if the query found anything by doing something

if $result==""
    echo("No result")
    echo("Result is: $result");

The problem I'm having is when there IS no result (and I know there isn't), it
doesn't store the value of NULL or "" in $result.  It still thinks $result has
a value, sometimes showing what the last valid result was (most likely because
it was left over in memory I would assume).

I've toyed around with mysql_store_result and mysql_use_result, but without
any luck.  I'm a beginner at this so I may be using the wrong syntax.

Any suggestions?


- John

Get your own FREE, personal Netscape WebMail account today at
How to use the value from a query?Silicon Ghost3 Aug
  • Re: How to use the value from a query?Paul DuBois3 Aug
  • Best way to move databaseWayne Spivak3 Aug
    • Best way to move databaseJani Tolonen3 Aug
    • Re: Best way to move databaseRalph Graulich4 Aug
    • Re: Best way to move databasetonu-mysql4 Aug