PHP Syntax Error Help

Discussion in 'PHP' started by turbohacker, Oct 5, 2010.

  1. #1
    Okay, I am having a problem with script... please help...

    Error:

    Parse error: syntax error, unexpected T_VARIABLE

    Im guessing in the mysql query, please help.


    <?php
    
    include('include/config.php');
    include('include/function.php');
    
    $future = date("Y:m:d G:i:s", strtotime("+3 day"));
    
    $mysql_host    = "localhost";
    $mysql_username = "user";
    $mysql_password = "pass";
    $mysql_database = "db";
    
    $UID = $_REQUEST['UID'];
    
    mysql_query("UPDATE subscriber SET expired_time='"$future"' WHERE UID='"$UID"'") or die(mysql_error());
    mysql_close();
    
    
    ?>
    PHP:
     
    turbohacker, Oct 5, 2010 IP
  2. zinalshah

    zinalshah Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    hi,

    Please replace below line and it's work fine
    mysql_query("UPDATE subscriber SET expired_time='".$future."' WHERE UID='".$UID."'") or die(mysql_error());
     
    zinalshah, Oct 5, 2010 IP
  3. koko5

    koko5 Active Member

    Messages:
    394
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #3
    Try this:
    mysql_query("UPDATE subscriber SET expired_time='{$future}' WHERE UID={$UID}") or die(mysql_error());
    PHP:
    Regards :)
    Edit: And, of course, you've to connect and select_db before querying DB.
     
    Last edited: Oct 5, 2010
    koko5, Oct 5, 2010 IP
  4. turbohacker

    turbohacker Peon

    Messages:
    163
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi thanks for the reply, I have sorted it myself now, I used this:

    mysql_query("UPDATE subscriber SET expired_time='" .mysql_real_escape_string($future). "' WHERE UID='" .mysql_real_escape_string($UID). "'") or die(mysql_error());
     
    turbohacker, Oct 5, 2010 IP