Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Syntax error: unexpected T_STRING

Featured Replies

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'].': £'.$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

  • Author

change line 92 to this

$output[] = '<li>'.$row['name'].': £'.$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! :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.