|
Posted by Call Me Tom on 05/09/07 21:44
Schraalhans Keukenmeester <invalid@invalid.spam> wrote in
news:pan.2007.05.09.21.17.08.176700@invalid.spam:
> At Wed, 09 May 2007 20:26:07 +0000, Call Me Tom let his monkeys type:
>
>> I have the following PHP/MySQL code segment
>>
>> $query2="UPDATE reports
>> SET fsacars_rep_url = $url_new
>> WHERE pilot_id = $pid";
>>
>> echo"$query2";
>>
>> $result2=mysql_query($query2) or die(mysql_error());
>>
>> The above code produces the following messages:
>>
>> The echo of the query shows:
>> UPDATE reports SET fsacars_rep_url = http://69.72.192.154/
>> ~caa/caa/logbooks/no_rept.txt WHERE pilot_id = 2
>>
>> When the query runs the following error message is generated:
>> You have an error in your SQL syntax; check the manual that
>> corresponds to your MySQL server version for the right syntax to use
>> near '://69.72.192.154/~caa/caa/logbooks/no_rept.txt WHERE pilot_id =
>> 2' at line 2
>>
>> What is the proper syntax?
>>
>> Thanks,
>> Tom
>
> Tom,
>
> Using strings in MySQL queries, enclose them in quotes:
>
> $query2="UPDATE reports
> SET fsacars_rep_url = '$url_new'
> WHERE pilot_id = $pid";
>
> // add quotes around $pid as well if it's a character field, not if
> it's a numerical value in the db.
>
> HTH
> Sh
>
Thanks. That solved the problem.
Tom
Navigation:
[Reply to this message]
|