Rosalie
10-04-2010, 08:55 PM
Hello everyone,
Okay, I tried;) to write this little script in php. I am obviously doing something wrong. I get the following error messages:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/rosalie/public_html/email.php on line 7
Warning: Cannot modify header information - headers already sent by (output started at /home/rosalie/public_html/email.php:7) in /home/rosalie/public_html/email.php on line 10
I want my script first to check whether the entered email address already excists in the database. When this isn't the case it should be added.
This is my script:
<?php
include('confform.php');
$query1="SELECT * FROM mailinglist WHERE email ='$email'";
$result1=mysql_query($query1);
$num1=mysql_num_rows($result1);
if($num1 != 0); {
header("Location:notregistered.html");
}
if($num1 == 0); {
$query2="INSERT INTO mailinglist SET email='$email'";
$result2=mysql_query($query2);
}
if($result2) {
header("Location:thankyou.html");
}
?>
Thanks in advance,
I hope to learn from it.
Okay, I tried;) to write this little script in php. I am obviously doing something wrong. I get the following error messages:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/rosalie/public_html/email.php on line 7
Warning: Cannot modify header information - headers already sent by (output started at /home/rosalie/public_html/email.php:7) in /home/rosalie/public_html/email.php on line 10
I want my script first to check whether the entered email address already excists in the database. When this isn't the case it should be added.
This is my script:
<?php
include('confform.php');
$query1="SELECT * FROM mailinglist WHERE email ='$email'";
$result1=mysql_query($query1);
$num1=mysql_num_rows($result1);
if($num1 != 0); {
header("Location:notregistered.html");
}
if($num1 == 0); {
$query2="INSERT INTO mailinglist SET email='$email'";
$result2=mysql_query($query2);
}
if($result2) {
header("Location:thankyou.html");
}
?>
Thanks in advance,
I hope to learn from it.