Jump to content

chum1215

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Posts posted by chum1215

  1. Hi, I hope you guys can help me out. I only know basic PHP and also SQL.  I haven't tried using connecting database yet.

     

    My problem is that I'm trying to INSERT a data into an existing table using access but when it reaches $rs = odbc_exec(); it returns an error that the query was empty.

     

    Here is the code:

    $conn=odbc_connect('trial','','');
    if (!$conn)
      {exit("Connection Failed: " . $conn);}
    $sql = "INSERT INTO Data (FirstName, LastName, BusinessName) 
    VALUES ('$fname', '$lname', '$bname')";
    
    $rs=odbc_exec($sql, $conn);
    
    $rs = @odbc_exec($conn,$sqlstring);
    
    if (!$rs)
    {
    echo "An error has occured. Please try again", odbc_errormsg($conn);
    }
    else
    {
    echo "The record was successfully inserted.";
    }
    
    odbc_close($conn);

     

     

    and here is the error:

    An error has occured. Please try again[MySQL][ODBC 5.1 Driver][mysqld-5.5.20]Query was empty

     

     

    I really hope you could help me out.

     

    Thanks.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.