Simple idea Stupid error?!!!! (stat script)
Posted: Mon Dec 06, 2004 6:54 am
right im pretty new to php so any help on this little error would be great
the following code gives out this error :-
Parse error: parse error, unexpected $ in /usr/home/l33/public_html/stat.php on line 23
A connection to the db is already set but i aint showing that
, anyways heres the code:-
thanks for taking the time to at least look at the code
L33
the following code gives out this error :-
Parse error: parse error, unexpected $ in /usr/home/l33/public_html/stat.php on line 23
A connection to the db is already set but i aint showing that
Code: Select all
<?
//Stat Script
$pagename = $_SERVER['PHP_SELF'];
$sql = "SELECT * FROM l33_stat WHERE (pagename = '$pagename')";
$res = mysql_query($sql) or die(mysql_error());
//if to check if there is a page by that name in db
if (!$res) {
$numofhits = "1";
$thedate = date('H:i F j, Y');
$sql = "INSERT INTO l33_stat (pagename,numofhits,lasthit) VALUES ('$pagename','$numofhits','$thedate')";
$res = mysql_query($sql) or die(mysql_error());
exit();
} else {
while ($row = mysql_fetch_array($res, MYSQL_NUM)){
$numofhits = $row['numofhits'];
$last = $row['lasthit'];
//$numberofhits = $numberofhits + 1;
$sql = "UPDATE l33_stat SET numberofhits = '$numberofhits' WHERE pagename = '$pagename'";
$res = mysql_query($sql) or die(mysql_error());
}
?>L33