hello everyone.
Just a quick question, the code below works, but I cant help thinking it could be improved. the SQL query retrieves an authors details based on a unique ID. Hence, I dont think I need a while loop to set the variables $name and $email. However, if i don't enclose these variables in a while loop, they dont get set. Is there another way?
Thanks in advance, all suggestions much appreciated.
$authors = mysql_query("select Name, EMail from Authors where ID=$id");
if (!$authors)
{
echo("<p>Error retrieving authors from the database!<br>".
"Error: " . mysql_error());
exit();
}
while ($author = mysql_fetch_array($authors)) {
$name = $author["Name"];
$email = $author["EMail"];
}