Page 1 of 1

unexpected T_STRING

Posted: Tue Jun 26, 2007 10:54 am
by ghadacr
Hi Guys,

I'm getting an
unexpected T_STRING
output from this piece of code:

Code: Select all

<?PHP

$daterep = str_replace("/","-",$datefrom);
$datereps = str_replace("/","-",$dateto);


$newdate = date ("d M Y", strtotime ($daterep)); 
$newdates = date ("d M Y", strtotime ($datereps)); 

setcookie("from", $newdate, time(  )+600);
setcookie("to", $newdates, time(  )+600);
setcookie("hotel", $subcat, time(  )+600);

$availabilty _days = $_GET['availabilty _days'];

if($availabilty _days > 0) {

$newdate = date('d M Y', strtotime("-$availabilty _days days"));

}

?>
The error seems tobe coming from this line of code:

Code: Select all

if($availabilty _days > 0) {
All help will be apperciated thanks....

Posted: Tue Jun 26, 2007 11:00 am
by Charles256
look at your code.it's color coded :-D notice how the variable near that line loses color coding? perhaps due to a space?... :-D

Posted: Tue Jun 26, 2007 11:05 am
by ghadacr
Ok changed it to

Code: Select all

$availabiltydays
but still getting the same error.....

Posted: Tue Jun 26, 2007 11:09 am
by volka
There are two occurences of $availabilty _days.
Did you change both? (apparently not)

Posted: Tue Jun 26, 2007 11:31 am
by ghadacr
GOT IT WORKING

Thanks, it was something completely nothing to do with that piece of code......

Posted: Tue Jun 26, 2007 11:46 am
by volka
The error message contains a file name and line number, e.g.
Parse error: syntax error, unexpected T_STRING in /home/volker/test.php on line 14
In the future please post the complete error message (includung the line number) and mark the mention line in the code snippet. Much easier for all of us this way.