Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > Simple Stuff (Newbies)

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-18-2012, 01:23 PM   #1
leekheed
Registered User
 
Join Date: Apr 2012
Posts: 5
Default Parse error: syntax error, unexpected T_VARIABLE

hi there, learning php (well trying to) and getting the error (Parse error: syntax error, unexpected T_VARIABLE on line 3.... could some possible help.. thanks for your time :@)

$allLines = file(".htCounter.csv");
while($line=array_pop($allLines)) {
list($url,$count) = split(":" $line);
$count = rtrim($count);
$counts[$url] = $count;
}
leekheed is offline   Reply With Quote
Old 04-19-2012, 05:19 AM   #2
xdeath
Deaths touch!!!
 
xdeath's Avatar
 
Join Date: Mar 2008
Posts: 775
Default

the variable "T_VARIABLE" isn't even in the code you shown us. so there either more code there your not showing us or its refering to a variable in another file which you didn't provide or show us.

regardless we can't help you with what you've provided. unless of course you know a way i can read peoples minds in which case then i could.
xdeath is offline   Reply With Quote
Old 04-19-2012, 04:44 PM   #3
leekheed
Registered User
 
Join Date: Apr 2012
Posts: 5
Default

here is the full script, thought it would be easier to post the lines were i thought the error was, thanks for the quick response :@)

<?php
if (!empty($_SERVER['HTTPS'])=="" or $_SERVER['HTTPS']=="off") {
$url_page_to_count = "";
} else {
$url_page_to_count = "";
}
$url_page_to_count = $url_page_to_count . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];


$allLines = file(".htCounter.csv");
while($line=array_pop($allLines)) {
list($url,$count) = split(":" $line);
$count = rtrim($count);
$counts[$url] = $count;
}

if ($counts[$url_page_to_count] > 0) {
$counts[$url_page_to_count]++;
$fh = fopen(".htCounter.csv", "w");
if (flock($fh, LOCK_EX)) {
foreach ($counts as $url=>$count) {
fwrite($fh, "$url,$count\n");
}
flock($fh, LOCK_UN);
}
fclose($fh);
$count = $counts[$url_page_to_count];
} else {
$fh = fopen(".htCounter.csv", "a");
if (flock($fh, LOCK_EX)) {
fwrite($fh, "$url_page_to_count,1\n");
flock($fh, LOCK_UN);
}
fclose($fh);
$count=1;
}

?>
leekheed is offline   Reply With Quote
Old 04-19-2012, 07:28 PM   #4
fruitbeard
Senior Member
 
Join Date: Feb 2012
Posts: 161
Default

Hi,

try putting

list($url,$count) = split(":", $line)

instead of

list($url,$count) = split(":" $line)

maybe it will help

my hobby - fgps.com/keith
fruitbeard is offline   Reply With Quote
Old 04-20-2012, 04:11 PM   #5
leekheed
Registered User
 
Join Date: Apr 2012
Posts: 5
Default

thanks for taken the time to help me, it worked but it has now given me the same error on line 13 !!
leekheed is offline   Reply With Quote
Old 04-21-2012, 09:35 AM   #6
fruitbeard
Senior Member
 
Join Date: Feb 2012
Posts: 161
Default

Hi,

msybe use this code instead of the other one as it's deprecated in higher versions of php.

Code:
list($url,$count) = explode(",", $line);
instead of

Code:
list($url,$count) = split(":", $line)
i get no errors testing here
fruitbeard is offline   Reply With Quote
Old 04-21-2012, 02:18 PM   #7
leekheed
Registered User
 
Join Date: Apr 2012
Posts: 5
Default

thanks for you time and help, everything seems to working fine now, again thanks :@)
leekheed is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT. The time now is 09:11 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.