#24720 [Com]: mysql_result(): supplied argument is not a valid MySQL result resource

From: Date: Thu, 15 Jul 2004 13:49:46 +0000
Subject: #24720 [Com]: mysql_result(): supplied argument is not a valid MySQL result resource
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-62382@lists.php.net to get a copy of this message
ID: 24720 Comment by: tomislav at escapestudio dot net Reported By: adrian at smartcall dot ro Status: Bogus Bug Type: MSSQL related Operating System: linux slackware PHP Version: 4.3.2 New Comment: I had the same problem and after spending a whole week on finding the solution, I gave Up. Only one was mentioned above: if ( $result != 1 ) while ($msrow = mssql_fetch_row($result)) { ... etc ... } Previous Comments: ------------------------------------------------------------------------ [2004-01-16 15:45:33] adrian at smartcall dot ro I have also the corect result when I run SQSH/FreeTDS. Still in php the problem persist, I didn't found a way to solve it ! ------------------------------------------------------------------------ [2004-01-16 14:12:57] savelazquez at megacable dot com dot mx I have the same problem on FreeBSD, I think this is a bug, and is not related to the O.S. I reproduced the same querys that PHP/FreeTDS fails to execute in SQSH/FreeTDS and they run fine. The problem presents when no records are found in the query using PHP/FreeTDS. ------------------------------------------------------------------------ [2003-07-24 09:27:27] iliaa@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php I unable to test mssql, however the test code does work correctly unless the query you execute is faulty. For example if you perform a select on a non-existant field the error that occurs when mysql_fetch_row() is called is identical to the one you describe. Which leads me to believe the error is the result of a bad query and not a behavioural change in PHP. ------------------------------------------------------------------------ [2003-07-21 06:12:34] adrian at smartcall dot ro I downloaded the latest snapshot ... compiled, instaled ... but with no success ... the result is still the same for mssql_query or mysql_query: When my query has no match I get 1 as result instead of a resurce id. Now I am writting myscripts this way : if ( $result != 1 ) while ($msrow = mssql_fetch_row($result)) { ... etc ... } But I don't think this is very elegant. P.S. Before I installed the slackware on the server I had a debian ( woody ), on which I had the same problem. So, is not a operating system problem ! ------------------------------------------------------------------------ [2003-07-20 10:47:53] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip And give a complete example script, WITHOUT any 'include/require' calls. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/24720 -- Edit this bug report at http://bugs.php.net/?id=24720&edit=1

« previous php.bugs (#62382) next »