Web Design Forum: Syntax error: unexpected T_STRING - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Syntax error: unexpected T_STRING Worked fine in a blank page but doesnt when put into my website? Rate Topic: -----

#1 User is offline   THRASHx 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 13
  • Joined: 26-January 10
  • Reputation: 0

Posted 17 March 2010 - 05:03 PM

Hey guys,

Im trying to add a shopping cart to my website, I did what I usually do and try it out in a new, blank PHP file. Then when ive tested it and it works I put it into my website.
So it worked fine originally, so I tried to copy the whole code and paste it into the existing webpage I want it to be included in.

So I try it and it seems good, until I upload it and get the following error when I try to visit the page:

Parse error: syntax error, unexpected T_STRING in /home/vhosts/citytourism.eu5.org/cart/index.php on line 92

Im just creating a tourism website for a project at college. The PHP used can be seen below:

Where line 92 is:
	$output[] = '<li>.$row['name'].': &pound;'.$row['price'].'<br /><a href="cart.php?action=add&id='.$row['id'].'">Add to cart</a></li>';


If someone could help me identify whats wrong id really appreciate it.

Ive tried messing with it so there may be some other things wrong now, but either way, it always points me to the line pasted above.

Thanks
0

#2 User is offline   Jay Gilford 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,104
  • Joined: 11-October 09
  • Reputation: 185
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 17 March 2010 - 05:07 PM

change line 92 to this
$output[] = '<li>'.$row['name'].': &pound;'.$row['price'].'<br /><a href="cart.php?action=add&id='.$row['id'].'">Add to cart</a></li>';

You were missing the ' after the <li>
2

#3 User is offline   Martin Greenwood 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 228
  • Joined: 22-June 09
  • Reputation: 5
  • Gender:Male
  • Location:Garstang
  • Experience:Advanced
  • Area of Expertise:SEO

Posted 17 March 2010 - 05:11 PM

nice one Jay :good:
0

#4 User is offline   THRASHx 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 13
  • Joined: 26-January 10
  • Reputation: 0

Posted 17 March 2010 - 05:12 PM

View PostJay Gilford, on 17 March 2010 - 05:07 PM, said:

change line 92 to this
$output[] = '<li>'.$row['name'].': &pound;'.$row['price'].'<br /><a href="cart.php?action=add&id='.$row['id'].'">Add to cart</a></li>';

You were missing the ' after the <li>


How did I not see that, thanks a lot! :)
0

#5 User is offline   Jay Gilford 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,104
  • Joined: 11-October 09
  • Reputation: 185
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 17 March 2010 - 05:14 PM

No problem :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users