Hi everyone, I am new to PHP, but not to programming. I am well versed in C, so the learning process is going quite smoothly and quickly. More so than I would have thought
But I digress....
In plain simple english, here is the query I am trying to perform on the MySQL server:
"What is the id of the person whose first name is ____"?
Here is my code:
$sql = "SELECT id FROM users WHERE firstname='$firstname';";
$result = mysql_query($sql);
$userrow = mysql_fetch_array($result);
$userid = $userrow["id"];
The $firstname var gets its value from the user who selects the name of the person. I have verified that $firstname contains the desired data.
It seems that $userid is always 0, no matter what.
What am I doing wrong here? Suggestions?