Could someone tell me what is wrong with the below please!!!!
Should I be using fetch row, fetch array or num_rows????
#add entry if NO matching record was found, else deny sign-up */
if(mysql_fetch_row($rs)) {
echo "The email address, $email has already been signed up for this event!";
}
else {
#create the 2nd query
$date="RDR_030605";
$sql="INSERT INTO events_bookings(date, fullname, email, mobile) VALUES ( \"$date\", \"$fullname\", \"$email\", \"$mobile\")";
Everytime I run it, I get the below message:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home2/rgevans/public_html/Regulars/events/rdr_signup/booking.php on line 147
- Basically I have a sign-up form where users sign up to an event. The code checks to see that they have not already
signed up. If they have already signed up they are told they are unable to. If they haven't then their signup is added to the db.
The full php is below.... Thanking in advance!!!
<?php
#ensure all fields have entries
if ($fullname and $email and $mobile)
{
#connect to mysql
$conn=@mysql_connect("localhost", "rgevans_adminuse", "excellent") or die ("Err:Conn");
#select the specified database
$rs = @mysql_select_db("rgevans_m2e", $conn) or die ("Err:Conn");
#create the 1st query
$date="RDR_030605";
$sql="SELECT * FROM events_bookings WHERE email = \"".$email."\" AND date = \"".$date."\"";
#add entry if NO matching record was found, else deny sign-up */
if(mysql_fetch_row($rs)) {
echo "The email address, $email has already been signed up for this event!";
}
else {
#create the 2nd query
$date="RDR_030605";
$sql="INSERT INTO events_bookings(date, fullname, email, mobile) VALUES ( \"$date\", \"$fullname\", \"$email\", \"$mobile\")";
#execute the query
$rs=mysql_query($sql,$conn);
}
#confirm the added record details
if($rs) {echo ("."); }
}
?>
----Ment2Excel (M2E)----
--LEARN BY EXAMPLE--
Should I be using fetch row, fetch array or num_rows????
#add entry if NO matching record was found, else deny sign-up */
if(mysql_fetch_row($rs)) {
echo "The email address, $email has already been signed up for this event!";
}
else {
#create the 2nd query
$date="RDR_030605";
$sql="INSERT INTO events_bookings(date, fullname, email, mobile) VALUES ( \"$date\", \"$fullname\", \"$email\", \"$mobile\")";
Everytime I run it, I get the below message:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home2/rgevans/public_html/Regulars/events/rdr_signup/booking.php on line 147
- Basically I have a sign-up form where users sign up to an event. The code checks to see that they have not already
signed up. If they have already signed up they are told they are unable to. If they haven't then their signup is added to the db.
The full php is below.... Thanking in advance!!!
<?php
#ensure all fields have entries
if ($fullname and $email and $mobile)
{
#connect to mysql
$conn=@mysql_connect("localhost", "rgevans_adminuse", "excellent") or die ("Err:Conn");
#select the specified database
$rs = @mysql_select_db("rgevans_m2e", $conn) or die ("Err:Conn");
#create the 1st query
$date="RDR_030605";
$sql="SELECT * FROM events_bookings WHERE email = \"".$email."\" AND date = \"".$date."\"";
#add entry if NO matching record was found, else deny sign-up */
if(mysql_fetch_row($rs)) {
echo "The email address, $email has already been signed up for this event!";
}
else {
#create the 2nd query
$date="RDR_030605";
$sql="INSERT INTO events_bookings(date, fullname, email, mobile) VALUES ( \"$date\", \"$fullname\", \"$email\", \"$mobile\")";
#execute the query
$rs=mysql_query($sql,$conn);
}
#confirm the added record details
if($rs) {echo ("."); }
}
?>
----Ment2Excel (M2E)----
--LEARN BY EXAMPLE--