|
Posted by naixn on 12/09/06 00:39
Michael Fesser 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
You have to remind that `` are used to define MySQL fields, databases, or
tables, not values ;)
--
Naixn
http://fma-fr.net
Navigation:
[Reply to this message]
|