RE: [PHP-DB] mysql_array_array

From: Date: Fri, 03 Dec 2004 13:31:57 +0000
Subject: RE: [PHP-DB] mysql_array_array
Groups: php.db 
Request: Send a blank email to php-db+get-37544@lists.php.net to get a copy of this message
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 03 December 2004 13:15, Yemi Obembe wrote: > $sql = "SELECT * FROM arcadia WHERE email=$v"; > $sql_in = "INSERT INTO arcadia ('email') VALUES ('$v')"; Spot the difference: you have quoted the email value $v in the INSERT (correct) but not in the SELECT (wrong). This means that: $res = mysql_query( $sql ) ; is failing with a SQL error, so $res is not being set to a valid MySQL result resource, so that when you execute: if (list($row) = mysql_fetch_array($res)) { The mysql_fetch_array() complains with the error you have seen. After any database operation, you should check for failure and echo out any error message -- see mysql_errno() (http://php.net/mysql_errno) and mysql_error() (http://php.net/mysql_error). Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.db (#37544) next »