query works in mysql, but not from php
| From: | Olav Drageset | Date: | Mon, 19 Nov 2001 22:58:14 +0000 |
| Subject: | query works in mysql, but not from php | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-75171@lists.php.net to get a copy of this message | ||
Hi
$sql = "SELECT user FROM persons WHERE user = '$firstName' and domain =
'$domainName' ; ";
$result = mysql_query($sql,$connection ) or die(mysql_error());
Calling above lines from php returns: You have an error in SQL syntax near ';' at
line 1
Issuing the command
SELECT user FROM persons WHERE user = 'fred' AND domain = 'company.net' ;
in mysql give a proper result.
Can anyone explain what might be causing the error???
regards Olav