RE: mysql_array_array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux