Current location: Hot Scripts Forums » Programming Languages » PHP » Parse error: syntax error


Parse error: syntax error

Reply
  #1 (permalink)  
Old 01-02-08, 09:47 AM
p51d78th p51d78th is offline
New Member
 
Join Date: Jan 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Parse error: syntax error

Hello,
I am having some issues converting some files from a mac to XP.

on my mac i have the following code:

PHP Code:

Line17 $config['base_url']    = "http://localhost/~david/accounts/";

Line18 $config['rel_path']     = "/Users/david/Sites/accounts/";

Line33 $config['index_page'] = "index.php"
I am trying to get this code working on my work computer (XP). I went and changed the above code to this:

PHP Code:

Line17 $config['base_url']    = "http://localhost/accounts/";

Line18 $config['rel_path']     = "C:\xampp\htdocs\accounts\";

Line: 33 - 
$config['index_page'] = "index.php"; 
Now I am getting the following error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\accounts\system\application\config \config.php on line 33

If i comment out line number 18 the code works fine (except the stuff relying on that config option).

I cant figure out why i am getting the error in Windows.

Any help will be apprciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 01-02-08, 09:49 AM
p51d78th p51d78th is offline
New Member
 
Join Date: Jan 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Alright I just realized what is going on, I just don't know how to fix it. The last \ on line 18 is keeping the quotes from closing. How do i do that?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 01-02-08, 09:50 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
Use two backslashes.

PHP Code:

$config['rel_path']     = "C:\\xampp\\htdocs\\accounts\\"
In PHP, the backslash is a special character, and needs to be escaped.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 01-02-08, 09:52 AM
p51d78th p51d78th is offline
New Member
 
Join Date: Jan 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
thanks that did it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
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 06:56 AM
Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' HELP stormshadow PHP 2 06-27-06 10:27 AM
Parse error: parse error, unexpected $ in... keefermedia PHP 4 04-23-06 12:21 PM
Parse error: parse error, unexpected T_VARIABLE aussietogo PHP 4 08-16-05 09:14 PM
[php error] parse error | fatal error xeoHosting PHP 1 01-03-04 09:12 PM


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