explain this warning to me please
Posted: Fri Apr 28, 2006 5:05 pm
trying to set up a form for subscribers to email newsletter
the form action takes you to a page using this code
which is giving me this warning:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /hsphere/local/home/bruceg/inspired-evolution.com/subscribe.php on line 46
and the email address isn't getting entered into the MySQL database.
the database contains a table called subscribers with three rows named email_addr, f_name, l_name in that order.
thanks in advance!
the form action takes you to a page using this code
Code: Select all
<?php
$connection = mysql_connect("localhost", "username", "password");
mysql_select_db("bruceg_mailinglist", $connection);
$rs = mysql_query("SELECT subscriber_id FROM subscribers WHERE email = '".$_REQUEST['email_addr']."'");
if(mysql_num_rows($rs) > 0) {
echo "That email address is already subscribed.";
}
else {
mysql_query("INSERT INTO subscribers('f_name', 'l_name', 'email_addr') VALUES('".$_REQUEST['f_name']."', '".$_REQUEST['l_name']."', '".$_REQUEST['email_addr']."')");
mail($_REQUEST['email_addr'], 'subscribers', 'You\'ve successfully subscribed to the inspired-evolution.com mailing list. If you want to unsubscribe simply go to http://www.inspired-evolution.com/unsub ... form.php.', 'From: webguync@gmail.com');
echo "<h2>Thank you for subscribing !</h2><p> we will be sending out a monthly newsletter related to web design and development using XHTML, CSS, Photoshop, PHP, MySQL, web standards and accessibility .";
}
?>Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /hsphere/local/home/bruceg/inspired-evolution.com/subscribe.php on line 46
and the email address isn't getting entered into the MySQL database.
the database contains a table called subscribers with three rows named email_addr, f_name, l_name in that order.
thanks in advance!