Problem with WHERE clause in SELECT
| From: | Randy Perry | Date: | Wed, 21 Jun 2000 23:57:25 +0000 |
| Subject: | Problem with WHERE clause in SELECT | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-562@lists.php.net to get a copy of this message | ||
The SQL query below returns no result from PHP though it works fine if I do
it thru telnet. The variable $email comes from a posted form and is set
correctly -- if I have echo $email in the same script it prints to screen an
email address that's in the database.
Anybody know why?
$sql = "SELECT * FROM customer WHERE email = $email";
$result = mysql_query($sql, $db);
while ($myrow = mysql_fetch_array($result)) {
printf("%s %s %s\n", $myrow["firstname"], $myrow["lastname"],
$myrow["email"]);
}
--
Randy Perry
rgp systems
Mac Consulting/Sales