mysql/php... strangely not processing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anfetienne
    Contributor
    • Feb 2009
    • 424

    #1

    mysql/php... strangely not processing

    this is the most simplest question... I am trying to insert some information into a test DB and i keep getting this error message

    "Error in query:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order) VALUES('','test ','738355238',' andre is the best','16/04/2010','1' at line 1"

    this is the same code i used in all of my sites but for sum reason it wont input into the DB and I cant figure out why the end of my query wont process


    Code:
    include ("admin-dbcon.php");
    
    $userName = $_SESSION['_amember_user']['login'];
    $firstName = $_SESSION['_amember_user']['name_f'];
    $firstName = ucfirst($firstName); 
    $lastName = $_SESSION['_amember_user']['name_l'];
    $lastName = ucfirst($lastName); 
     
    $commentID=rand(0000000000,9999999999);
    $dateAdded = '16/04/2010';
    $toPost= $_POST['comment'];
    $userAV= 'test';
    $userAVB= '/user/aetienne/av/av.jpg';
    $i='1';
    
    mysql_connect($hostname,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    
    $sql = "SELECT * FROM statusUpdates WHERE userName = '{$userName}'";
    $res = mysql_query( $sql ) or die( mysql_error );
     
    if ( mysql_num_rows( $res ) < 1 )
    {
    
    $query="INSERT statusUpdates (userName,userAV,commentID,comment,dateAdded,order)
    
            VALUES('".$userName."','".$userAV."','".$commentID."','".$toPost."','".$dateAdded."','".$i."')";
    }
    
    $result=mysql_query($query) or die("Error in query:".mysql_error()); 
    //if ($result) 
        //echo mysql_affected_rows()." row inserted into the database effectively."; 
    
    mysql_close();
    ?>
  • anfetienne
    Contributor
    • Feb 2009
    • 424

    #2
    i fixed it...

    Comment

    Working...