1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Parse error: syntax error, unexpected T_VARIABLE

Discussion in 'PHP' started by leeno, Oct 1, 2007.

  1. #1
    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.
    SEMrush
    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'];
     
    leeno, Oct 1, 2007 IP
    SEMrush
  2. rickvb

    rickvb Active Member

    Messages:
    157
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #2
    You forgot to end the while loop

    while($blah = mysql_fetch_rows($query)){

    // do something in the loop

    } //close tag!!
     
    rickvb, Oct 1, 2007 IP
  3. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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.
     
    TwistMyArm, Oct 1, 2007 IP
  4. Ervee

    Ervee Peon

    Messages:
    53
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    this error most often means you forgot one of these
    '
    ;
    '
    "
    )
    (
    [
    ]
     
    Ervee, Oct 1, 2007 IP
  5. dcjokerbx

    dcjokerbx Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    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);
    }
    }


    ?>
     
    dcjokerbx, May 10, 2012 IP
  6. Wesleyy

    Wesleyy Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Don't dig up threads from 5 years ago after you already made a new thread about the exact same problem.
     
    Wesleyy, May 10, 2012 IP