Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2009

    Unanswered: PHP with ODBC INSERT INTO fails

    Hi all Doing a project for Uni here and am having a problem Insert date into one table the Code I am using as as follows

    $Conn = odbc_connect ('0602', 'root', '');

    $fbcom = $_REQUEST['fbcom']; $fbrating = $_REQUEST['fbrating']; $fbdate = $_REQUEST['fbdate']; $fbcust = $_REQUEST['fbcust']; $fbdate = $_REQUEST['fbdate'];

    $post = odbc_prepare($Conn, "INSERT INTO feedb(comments, rating, date, Custid)VALUES('$fbcom', '$fbrating', '$fbdate', '$fbcust')");

    if (!odbc_execute($post))
    {echo "Feedback Table Update failed";}

    else {{echo "Feedback Table Updated";}

    I am usig microsoft access as my database, I have the same code from inserting data into two tables and it works fine on that, I have removed all relationship from the feedback table so at the moment nothing else effects it and it has one more field that is a primary key that is set using auto number,

    this ha mt stumped and I need help big time.

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    have you checked the ODBC_ErrorMsg, and if so what did it tell you was wrong?

    I'm surprised you are using odbc_prepare & odbc_execute.. I thought these were only used on strored procedures, something I don't think JET supports. I would have expected to be using odbc_exec
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jul 2009
    Ok turned on the ODBC_ErrorMsg

    and it comes back with

    Error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.

  4. #4
    Join Date
    Jul 2009
    OK thanks for the help have solved the problem

    I believe that date is restricted so changed this to fbdate and all was well

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts