Jump to content


Photo

Annoying syntax error...


Best Answer Ch0cu3r, 05 October 2013 - 09:36 AM

The thing I see wrong with that code is only line 32 

 

unset($_SESSION)['AVA']);

 

The ) shouldn't be there after $_SESSION.

 

make sure you're saving your .php files as UTF-8 encoding (without the BOM)

Go to the full post


  • Please log in to reply
2 replies to this topic

#1 ash992

ash992

    Advanced Member

  • Members
  • PipPipPip
  • 56 posts

Posted 05 October 2013 - 09:23 AM

Hi guys, so I've been getting this syntax error for the past 2 days, and I can't get it to work at all... though I'm sure it's probably something quite simple that I just haven't noticed. the error is 

 

 

 

Parse error: syntax error, unexpected '[', expecting ';' in /home/folklore/public_html/AS/Engines/updatebasket.php on line 14

 

 

in the document there is the following code;

<?php

session_start();

$name = $_SESSION['name'];

$rows = $_SESSION['rows'];

$price = $_SESSION['price'];

$choice = $_SESSION['choice'];

$quan = $_SESSION['quantity'];

$remove1 = $_POST['remove1'];

//CHECK FOR ITEMS TO BE REMOVED

if ($remove1 == 'yes'){

	$rows = $rows - 1;
	$_SESSION['rows'] = $rows;
	
	unset($_SESSION['name']);

	unset($_SESSION['price']);

	unset($_SESSION['choice']);

	unset($_SESSION['quantity']);
	
	unset($_SESSION)['AVA']);

}

Line 14 is empty, but the line follows is the line that reads $remove1 = $_POST['remove1'];

 

I can't see a syntax error, but possibly I've missed something simple. any advice would be much appreciated!

 

thank-you in advance :) 



#2 Ch0cu3r

Ch0cu3r

    Advanced Member

  • Moderators
  • 2,539 posts

Posted 05 October 2013 - 09:36 AM   Best Answer

The thing I see wrong with that code is only line 32 

 

unset($_SESSION)['AVA']);

 

The ) shouldn't be there after $_SESSION.

 

make sure you're saving your .php files as UTF-8 encoding (without the BOM)



#3 ash992

ash992

    Advanced Member

  • Members
  • PipPipPip
  • 56 posts

Posted 05 October 2013 - 09:41 AM

Goddd. Thank-you very much! it's working now, can't believe I didn't see this.:( 

 

thanks a lot though :)






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com