2007-08-17 16:23:41 UTC
Specifically, I am doing a query based on an "if" statement, such as below:
if($nameresult!="")
$query = ("SELECT * FROM $table WHERE name='$nameresult'");
$nameresult being the post results from a form on the page this code is on. Noticed the "!=" in the statement. If the field is not blank, it will do the query.
Now, what I would like to have, is when the name typed into the field is not found in the database, it will return a custom error printed instead, or it pulls a specific line in my database that has "No results" for a name, which is easy enough to query for. How do I specify/acknowledge the condition of an empty result and act on it?
Sorry for the newbie question, if the answer is obvious to some.