RE: [PHP-DB] PHP4 and mysql_fetch_array() - one more try

From: Date: Thu, 02 Nov 2000 15:52:48 +0000
Subject: RE: [PHP-DB] PHP4 and mysql_fetch_array() - one more try
Groups: php.db 
Request: Send a blank email to php-db+get-4144@lists.php.net to get a copy of this message
Sorry to butt in but its rather foolish to start blaming PHP when you haven't even looked at the error. Try the code below and it should give you more of an idea of whats going wrong and if the code worked with PHP3 as you've said then you will probably find its a configuration difference/problem. $rs_result = mysql_db_query($db, "SELECT * FROM XX WHERE something=$yy", $connection) or die ("Error in ".__FILE__." at line ".__LINE__."<br>".mysql_errno()." : ".mysql_error()); while($row_result = mysql_fetch_array($rs_result)) { do_something(); } Nick -----Original Message----- From: Robert Vetter [mailto:vetter@rundschau-onlinedienst.de] Sent: 02 November 2000 14:24 To: Phil Driscoll Cc: php-db@lists.php.net Subject: Re: [PHP-DB] PHP4 and mysql_fetch_array() - one more try Phil Driscoll wrote: > > >Well, I can't quite understand this, because it is not an error if a > >SELECT query returns no rows! An error is, for example, if there would > >be a syntax error in SQL statement, or a query on a non-existing table, > >or something like this. I think PHP developers should have a look at > >this issue... > > Robert > > Please re-read the email I sent to you and the list yesterday. > Your mysql_db_query is returning 0, meaning that some kind of error occurred > (NOT that no rows were returned!). > mysql_error() will probably tell you what the error was. > You cannot safely use the return from mysql_db_query (or indeed many other > functions) without first checking that it did not return an error. Phil, sorry, I can't agree. The code example from my first email works fine with PHP3. I have plenty of scripts, which use that code scheme, that run with PHP3 without any problems. After I had upgraded my Apache server to PHP4 in my testing environtment I got those warning messages. For me it means that there are some compatibility problems between PHP3 and PHP4. Robert -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#4144) next »