syntax error, unexpected T_VARIABLE 
September 5th, 2008, 10:05 PM
| | | |
I have been trying to get past this error all day. I am unable to
determine why I get syntax error from the following code:
//modify a record
$myDataID = mysql_query("UPDATE members SET first_name = $name_update
WHERE email = $targetEmail", $connectID);
Can someone tell me what is wrong with this.
Thank You
Gerald Stanley | 
September 5th, 2008, 10:15 PM
| | | | re: syntax error, unexpected T_VARIABLE
On Sep 5, 10:02*pm, stanman <GStanle...@gmail.comwrote: Quote:
I have been trying to get past this error all day. I am unable to
determine why I get syntax error from the following code:
>
//modify a record
$myDataID = mysql_query("UPDATE members SET first_name = $name_update
WHERE email = $targetEmail", $connectID);
>
Can someone tell me what is wrong with this.
Thank You
Gerald Stanley
| Please post a few lines before this and also the full error message. | 
September 6th, 2008, 12:05 AM
| | | | re: syntax error, unexpected T_VARIABLE
stanman wrote: Quote:
I have been trying to get past this error all day. I am unable to
determine why I get syntax error from the following code:
>
//modify a record
$myDataID = mysql_query("UPDATE members SET first_name = $name_update
WHERE email = $targetEmail", $connectID);
>
Can someone tell me what is wrong with this.
Thank You
Gerald Stanley
| You may try:
$myDataID = mysql_query("UPDATE members SET first_name = '$name_update'
WHERE email = '$targetEmail'", $connectID);
scotty | 
September 8th, 2008, 03:35 AM
| | | | re: syntax error, unexpected T_VARIABLE
stanman wrote: Quote:
I have been trying to get past this error all day. I am unable to
determine why I get syntax error from the following code:
>
//modify a record
$myDataID = mysql_query("UPDATE members SET first_name = $name_update
WHERE email = $targetEmail", $connectID);
>
Can someone tell me what is wrong with this.
| It's off-topic, but you should try to escape the string inputs, or
avoid combining inputs to query completely by using parameterized
queries.
A simple version is "UPDATE members SET first_name = '" .
mysql_escape_string($name_update) . "' WHERE email = '" .
mysql_escape_string($targetEmail) . "'"
You would also need to make sure the client encoding is correct.
If you're using PHP5, you can use parameterized queries in mysqli or
PDO | 
September 8th, 2008, 04:15 AM
| | | | re: syntax error, unexpected T_VARIABLE
AqD wrote: Quote:
stanman wrote: Quote:
>I have been trying to get past this error all day. I am unable to
>determine why I get syntax error from the following code:
>>
>//modify a record
>$myDataID = mysql_query("UPDATE members SET first_name = $name_update
>WHERE email = $targetEmail", $connectID);
>>
>Can someone tell me what is wrong with this.
| >
It's off-topic, but you should try to escape the string inputs, or
avoid combining inputs to query completely by using parameterized
queries.
>
A simple version is "UPDATE members SET first_name = '" .
mysql_escape_string($name_update) . "' WHERE email = '" .
mysql_escape_string($targetEmail) . "'"
>
You would also need to make sure the client encoding is correct.
>
If you're using PHP5, you can use parameterized queries in mysqli or
PDO
>
| Properly constructed statements work quite well without parameterized
queries.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attglobal.net
================== | 
September 8th, 2008, 11:25 AM
| | | | re: syntax error, unexpected T_VARIABLE
AqD wrote: Quote:
stanman wrote: Quote:
>I have been trying to get past this error all day. I am unable to
>determine why I get syntax error from the following code:
>>
>//modify a record
>$myDataID = mysql_query("UPDATE members SET first_name = $name_update
>WHERE email = $targetEmail", $connectID);
>>
>Can someone tell me what is wrong with this.
| >
It's off-topic, but you should try to escape the string inputs, or
avoid combining inputs to query completely by using parameterized
queries.
>
A simple version is "UPDATE members SET first_name = '" .
mysql_escape_string($name_update) . "' WHERE email = '" .
mysql_escape_string($targetEmail) . "'"
>
You would also need to make sure the client encoding is correct.
| Use mysql_real_escape_string for this. Quote:
If you're using PHP5, you can use parameterized queries in mysqli or
PDO
| --
Curtis |  |
Similar Threads | | Thread | Thread Starter | Forum | Replies | Last Post | | Parse error: syntax error, unexpected T_VARIABLE | URmusicandvideo | answers | 25 | October 31st, 2008 07:23 AM | | Parse error: syntax error, unexpected T_VARIABLE | james2432 | answers | 1 | July 31st, 2008 11:05 PM | | dont know how to get rid of syntax error, unexpected T_VARIABLE | ashraf02 | answers | 7 | February 25th, 2008 11:53 PM | | Parse error: syntax error, unexpected T_VARIABLE on line 4 | needhelp08 | answers | 4 | December 25th, 2007 05:38 AM | | Parse error: syntax error, unexpected T_VARIABLE | SilvaZodiac | answers | 3 | December 2nd, 2007 10:27 AM | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,689 network members.
|