MySQL frustration
| From: | Tom Peck | Date: | Tue, 18 Jul 2000 02:43:08 +0000 |
| Subject: | MySQL frustration | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7005@lists.php.net to get a copy of this message | ||
Good afternoon everyone
I'm tearing my hair out over this one - it seems so simple - but it's not
doing what it's told... All I want to do is check if $tempName exists in
the database - and if it doesn't I want to know. BUT no matter what i have
tried - it either doesn't think it exists when it does - or the opposite.
This is the latest piece of code I have been trying - can anyone find any
problems with it? It seems that $result is always true - no matter what
$tempName is equal to. How is this possible?
Thanks for any help.
// The frustrating code
$tempName = "This Person";
$sql = "SELECT * FROM tblPlayers WHERE fldName='$tempName'";
$result = mysql_query($sql);
if ( $result ) {
echo "<br> RESULT TRUE!";
}
else
echo "<br> RESULT FALSE!";
}