OK, I know that and that's what I tried to explain in the last post.(not a native english speaker) I found out tryng this.
$result = mysql_query("SELECT * FROM fake_table", $dbh) ;
if ($results == NULL) {
echo "NULL value" ;
} elseif ($results == "NULL") {
echo "\"NULL\" text" ;
} elseif ($results == 0) {
echo "0" ;
} elseif ($results == 1) {
echo "1" ;
} else {
echo "no idea: $result" ;
}
Becasue the db table is fake(a table that I havn't created in the db) there is no way the $result will contain a real query and I got "NULL value" from the if statement.
When I tried:
$result = mysql_query("SELECT * from real_table WHEN id = 2000", $dbh) ;
if ($results == NULL) {
echo "NULL value" ;
} elseif ($results == "NULL") {
echo "\"NULL\" text" ;
} elseif ($results == 0) {
echo "0" ;
} elseif ($results == 1) {
echo "1" ;
} else {
echo "no idea: $result" ;
}
Becaue the table is a real table(one that I created and know has 2 entries) and I know the id comparison is not going to give me anything back because there are no id values = 2000, I should get a "NULL value" back from the if statemnt and that's exactly what I get.
Now the question is: what happens when I don't get a NULL for the mysql_query function ($results != NULL) but when I run the mysql_fetch_array function I get nothing? I have tried using the mysql_fetch_array and mysql_fetch_row to get the info out of $results but I get nothing. I even got PHP to print out the query it's using to the screen, then copy/paste-ed it over to a straight, command prompt, mysql session to see if the query was wrong(syntax and such). But from the command line I get the results I expect. The query does show me that the word "PHP is in the first row and not on the second. So I realy don't know what's going on.