Hi there, Parse error: syntax error, unexpected T_VARIABLE in /home/username/public_html/website/bookstore/classes.php on line 69 I would be most grateful if someone could put me right on the error I have below. I did read that the error can be somewhere else on the page and maybe not on line 69 is that correct? I have included part of the codes below. Many thanks hope you can help. LINE 65 global $db,$prefix; LINE 66 LINE 67 LINE 68 LINE 69 $result = $db->query ("SELECT the_key, body FROM " $prefix ."email"); LINE 70 LINE 71 LINE 72 LINE 73 while($row = $result->fetch_array()) LINE 74 LINE 75 { LINE 76 LINE 77 $key = $row['the_key']; LINE 78 LINE 79 $EMAILS["$key"] = $row['body'];
You forgot to end the while loop while($blah = mysql_fetch_rows($query)){ // do something in the loop } //close tag!!
Instead of: $result = $db->query ("SELECT the_key, body FROM " $prefix ."email"); it should be: $result = $db->query ("SELECT the_key, body FROM " . $prefix ."email"); You forgot to put the concatenator(sp?) before the $prefix variable.
I have a similar problem. I get the same error message on line 17. Here is my code. <?php //ASSIGN THE BASIC VARIABLES FOR YOUR VISITOR $time = date("M j G:i:s Y"); $ip = getenv('REMOTE_ADDR'); $userAgent = getenv('HTTP_USER_AGENT'); $query = getenv('QUERY_STRING'); //COMBINE VARS INTO OUR LOG ENTRY $msg = " TIME: " . $time . " USERAGENT: " . $userAgent. " USER-QUERY: " . $query. "IP: " . $ip; //CALL THE CENTRAL FUNCTION TO WRITE TO THE LOG FILE writeToLogFile($msg); function writeToLogFile($msg) { $today = date("Y_m_d"); $logfile = $today."_log.txt"; $dir = 'logs'; $saveLocation=$dir . '/' . $logfile; if (!$handle = @fopen($saveLocation, "a")) { exit; } else { if(@fwrite($handle,"$msg\r\n")===FALSE) { exit; } @fclose($handle); } } ?>
Don't dig up threads from 5 years ago after you already made a new thread about the exact same problem.