Hi!
I have a table which contains e-mail addresses but each only once!
Through a form the user submits the e-mail address and the php/mysql code looks if the submited e-mail address is already in the table or not.
But there is a problem when i select from the table:
//code part
$result = mysql_query("SELECT * FROM lottoman5 WHERE email=$email");
if ( $myrow = mysql_fetch_array($result) ) //at this line IS THE PROBLEM:"supplied argument is not a valid mysql request"
.....
//end of code part
I think mysql_fetch_array doesn't like the "WHERE email=$email" condition.
What's the problem??
Thanks for your answer!
The full code:
<body>
<?php
do {
$db = mysql_connect( "sql", "username", "password" );
} while (!$db);
print ( "Connected<br>\n" );
mysql_select_db ("database")
or die ("No database!<br>\n");
print ( "Database OK<br>\n" );
if ($submit)
{
$result = mysql_query("SELECT * FROM lottoman5 WHERE email=$email");
if ( $myrow = mysql_fetch_array($result) )
printf( $myrow["email"] );
else printf("not found!");
} else {
?>
<form method="post" action="<?php echo $PHP_SELF ?>">
Email:<input type="text" name="email"><br>
<input type="Submit" name="submit" value="search">
</form>
<?php
}
?>
</body>