|
Posted by Larry in Honolulu on 12/09/06 19:30
In article <fksjn21rkcqrt7ndg1cot1lg4jk76f5r7t@4ax.com>, Michael Fesser <netizen@gmx.de> wrote:
>..oO(Larry in Honolulu)
>
>>I'm getting an error message that makes no sense to me. I have a table with a
>>field named 'testkey' for a list of "keys" in the form of ABC10102. I have a
>>php variable holding a specific key number.
>>
>>The relevant code is -
>> $_testkey = 'LAL10102';
>> $sql = "SELECT * FROM `pro_keys` WHERE `keynum`=`$_testkey`";
>> $result=mysql_query($sql,$db_conn);
>
>Strings in an SQL query have to be quoted (and drop the backticks):
>
>$sql = "SELECT * FROM pro_keys WHERE keynum = '$_testkey'";
>
>Micha
Thanks Michael,
I've been away from MySql for a while and forgot that. Oddly I have another
query on the same page (different fields and different variable) that uses the
same syntax, though with no backtics and no quotes of any kind that works just
fine.
Larry L
Navigation:
[Reply to this message]
|