Need mysql query edited - URGENT

Discussion in 'Programming' started by jeeplaw, Oct 23, 2006.

  1. #1
    This code has been bothering me, but i'm getting this error and I know it should theoretically work!

    Here's the error-

    Parse error: syntax error, unexpected '=' in /home/jeeplaw/domains/siteopoly.com/public_html/wp-content/plugins/wp_geotrack/wp_geotrack.php on line 215

    Here's the code:

    $sql = 'SELECT *, DATE_FORMAT(access_time, \''.$gt_options['gt_dateformat'].'\') AS datestr
    FROM '.$table_prefix.'geotrack
    WHERE status < 400 ' AND uri = '".$_SERVER['HTTP_HOST']."'";


    Any ideas?

    The basic premise is that there's a field in the db that is called uri and I'm saying that if the uri field is the same as the url on the current page, pull the record. But the query is breaking.
     
    jeeplaw, Oct 23, 2006 IP
  2. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #2
    $sql = "SELECT *, DATE_FORMAT(access_time, '" . $gt_options['gt_dateformat'] . "') AS datestr
    FROM " . $table_prefix . "geotrack
    WHERE status < 400 AND uri = '" . $_SERVER['HTTP_HOST'] . "'";
     
    SoKickIt, Oct 24, 2006 IP
  3. jeeplaw

    jeeplaw Well-Known Member

    Messages:
    827
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    118
    #3
    That did the trick :) Thank you
     
    jeeplaw, Oct 24, 2006 IP