[thelist] php add email to a mysql db
Gary Bland
Gary at star-chaser.com
Tue Aug 13 11:42:38 CDT 2002
Andrew Maynes wrote:
> nope, now getting...
>
> Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource
> in /usr/home/public_html/demo/order2.php on line 12
> couldn't execute query
>
>
> with
>
> include("settings.inc");
>
> mysql_connect("$dbhost","$dbuser","$dbpass");
>
> $$sql = "SELECT email FROM mailinglux WHERE
> email='$email'";
> $result=mysql_query($sql);
> $num=mysql_numrows($result);
> if ($num > 0)
> echo "<center><h3>You are already in our system</h3>";
> else {
>
> $sql = "INSERT INTO mailinglux(email) VALUES
> ('$email')";
>
>
> $result = mysql_query($sql) or die ("couldn't execute query");
>
>
> if(!EmailOK($email)) {
>
> echo "The email address you submitted is not valid.";
>
> exit;
> }
>
> mysql_db_query($dbname, "insert into mailinglux values('','$email')");
> }
>
> ----------
>
You have a typo
$$sql = "SELECT email FROM mailinglux WHERE
--
Gary Bland
StarChaser Web Architecture
http://star-chaser.com
Building Tomorrow's World Today
More information about the thelist
mailing list