RE: [PHP-DB] mysql_array_array

2004-12-03 Thread Ford, Mike
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: [EMAIL PROTECTED]
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



[PHP-DB] mysql_array_array

2004-12-03 Thread Yemi Obembe
The following script:
 

Share the fun!




 
 

Your email: $v already in the list";
}
  else {
   $sql_in = "INSERT INTO arcadia ('email') VALUES ('$v')";
  $result_in = mysql_query($sql_in);
   echo "Your email: $v subscribed!";
}
  }
else {
header("location : http://ng.clawz.com/index.php";);
exit;
}
?>



 
gives the error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result 
resource in /var/www/ng/subscribe.php on line 32

the concept of the script is to first see if the subscribed email is not 
already in the list (to prevent double subscription) before subscribing. but 
dis always come out wit d above error. what do you think could be wrong?





-

A passion till tomorrow,
www.opeyemi.tk




__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com