RE: [PHP-DB] MySQL Result Resource
| From: | Miles Thompson | Date: | Thu, 10 Jan 2002 15:36:10 +0000 |
| Subject: | RE: [PHP-DB] MySQL Result Resource | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-15615@lists.php.net to get a copy of this message | ||
Break up the code.
I assume you are connecting to the database with mysql_connect() or mysql_pconnect(). If not, do that.
Echo your query so that you know it contains valid values.
Break $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg ));
into
$result = mysql_query( $arg ) or die(mysql_errno()." : ". mysql_error() );
$row = mysql_fetch_array($result) )
then do whatever processing you need with the array $row.
Miles
PS Just reply to the list, if you reply directly to me I have one more message to delete. <g> /mt
At 02:10 AM 1/11/2002 +1100, Necro wrote:
Yeh, I notice now the MD5 was wrong. But I still get the same error on line 104. If I try and replace it with the current query function then I get two errors. e.g. Warning: Supplied argument is not a valid MySQL-Link resource in d:\htdocs\infekt\packages\auth.inc on line 104 Warning: Supplied argument is not a valid MySQL result resource in d:\htdocs\infekt\packages\auth.inc on line 104 Andrew -----Original Message----- From: Miles Thompson [mailto:milesthompson@ns.sympatico.ca] Sent: Friday, 11 January 2002 2:05 AM To: Necro; php-db@lists.php.net Subject: Re: [PHP-DB] MySQL Result Resource The use of the MD5 function in the query doesn't look quite right. Shouldn't it be MD5('$password') or MD5('$username'.'$password') if concatenating? Also, mysql_db_query() has been a deprecated function for some time now, mysql_query() is recommended. Hope this gets you going - Miles Thompson At 01:33 AM 1/11/2002 +1100, Necro wrote: Lo all, Slight problem on an auth script... Warning: Supplied argument is not a valid MySQL result resource in d:\htdocs\infekt\packages\auth.inc on line 104 Line 26: define( "DATABASE", "imanager" ); Line 103: $arg = "select password, 1 as auth from acl where username='$username' and password=MD5('$username','$password')"; Line 104: $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg )); Can anyone help get this to work?? Thankyou. Andrew -- 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