Hi there, i am working on a script that will take a variable and test the result with the database to see if it already exists.
If the result exists it will allow it to proceed but if it doesn't exist it will stop and prompt the user that this is not a valid result.
This is for use in a private mail system to prevent messages being send to null users by things like spelling mistakes.
I would appreciate any help with this please.
So far i have come up with this but i know i am going wrong somewhere.
If the result exists it will allow it to proceed but if it doesn't exist it will stop and prompt the user that this is not a valid result.
This is for use in a private mail system to prevent messages being send to null users by things like spelling mistakes.
I would appreciate any help with this please.
So far i have come up with this but i know i am going wrong somewhere.
PHP:
$sql = mysql_query ("SELECT `username` FROM `users`");
while($row = mysql_fetch_array($sql))
{
if ($row['username'] == '$testto')
{
$to = $testto;
}
else
{
$to = "Username not reconised";
}
}
echo $to;