mysql_array_array
| From: | Yemi Obembe | Date: | Fri, 03 Dec 2004 13:14:33 +0000 |
| Subject: | mysql_array_array | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-37543@lists.php.net to get a copy of this message | ||
The following script:
<html>
<head><title>Share the fun!</title></head>
<style type="text/css">
<!--
body {
font: normal 10px verdana;
background: #ffcccc url("arc.gif") 120px 70px no-repeat;
}
input {
border: 1px solid #ff9966;
text-align:right;
}
u {
color: #ff3333;
}
-->
</style>
<body>
<p> </p>
<p> </p>
<center>
<?php
if ($v = strtolower($_POST['email'])) {
$host = mysql ;
$user = "myusername" ;
$pass= "mypassword" ;
mysql_connect($host , $user , $pass ) ;
mysql_select_db("ng") ;
$sql = "SELECT * FROM arcadia WHERE email=$v";
$res = mysql_query( $sql ) ;
if (list($row) = mysql_fetch_array($res)) {
echo "<b>Your email: <u>$v</u> already in the list<br>";
}
else {
$sql_in = "INSERT INTO arcadia ('email') VALUES ('$v')";
$result_in = mysql_query($sql_in);
echo "<b>Your email: <u>$v</u> subscribed!<br>";
}
}
else {
header("location : http://ng.clawz.com/index.php");
exit;
}
?>
</center>
</body>
</html>
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