Hi, i'm pretty new to php and mysql so bear with me...
I have a table called "contacts" and it has a column called "name". i'm trying to get the "id" of the row that has a "name" that matches my a variable, $name. here's the code:
if( $result = mysql_query("SELECT * FROM contacts WHERE name=$name", $db) ) {
$myrow = mysql_fetch_array($result);
$nameid = $myrow["id"];
printf("%s<Br>", $nameidID);
}
else {
echo mysql_error();
exit;
}
the error is Unknown column 'Alex' in 'where clause'
Alex is the value of $name
If anyone knows how to fix this i'd appreciate it. thanks.
krishna