Current location: Hot Scripts Forums » Programming Languages » PHP » Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE


Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE

Reply
  #1 (permalink)  
Old 04-06-09, 05:01 PM
dimkasmir dimkasmir is offline
New Member
 
Join Date: Apr 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE

I am getting

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\root\www\trading.php on line 10

from the following line of code:

PHP Code:

$order mysql_query("UPDATE geocoins SET gid = $i WHERE name = $arrayn['0'] "); 

Any ideas?
Reply With Quote
  #2 (permalink)  
Old 04-06-09, 06:12 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
Try this ....

PHP Code:


$order 
mysql_query("UPDATE geocoins SET gid = '$i' WHERE name = '$arrayn['0']' "); 
Reply With Quote
  #3 (permalink)  
Old 04-06-09, 06:44 PM
landing's Avatar
landing landing is offline
Coding Addict
 
Join Date: Jul 2006
Location: Scotland
Posts: 302
Thanks: 0
Thanked 0 Times in 0 Posts
The following should work also

PHP Code:

$order mysql_query("UPDATE `geocoins` SET `gid` = '$i' WHERE `name` = '$arrayn[0]'"); 

__________________
Always sanitise your data


Best regards
Reply With Quote
  #4 (permalink)  
Old 04-07-09, 03:55 PM
jtanmay jtanmay is offline
Newbie Coder
 
Join Date: Apr 2009
Location: Tampa, FL
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
i hope u have solved this one.

but if not, check if you have missed ";" some where.
if you have started session but you have spaces before it.
you may have included a file, and that file could have extra spaces at the end of file
and might be some where you have forgot to close " or ' in code.
Reply With Quote
  #5 (permalink)  
Old 04-07-09, 04:03 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
The error comes from these 2 single quotes inside the double quoted string.

Landing's solution should work. And an alternative way of doing it would be:
PHP Code:

$order mysql_query("UPDATE geocoins SET gid = $i WHERE name = {$arrayn['0']} "); 

Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRIN aprogrammer PHP 20 08-31-11 05:56 AM
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or DeadPHP PHP 8 09-10-10 04:06 AM
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' Dr. Forensics PHP 3 07-15-06 03:54 PM
parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting '}' unlisted80 PHP 8 07-05-06 04:28 PM
Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' HELP stormshadow PHP 2 06-27-06 09:27 AM


All times are GMT -5. The time now is 08:32 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.