Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2005
    Posts
    1

    Unanswered: Warning: odbc_do(): SQL error:????? what is wrong?

    Warning: odbc_do(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query., SQL state S1000 in SQLExecDirect in c:\inetpub\wwwroot\fyp\inputproduct.php on line 32

    i received this warning when load the page and i wonder where did i make the mistake..i've been trying to look around for the solution yet can't find any..and by the way..i'm using Ms. Access as my database..please help me..thanks a lot in advance...

    PHP Code:
    <?
    function checkOK($field)
    {
        if (
    eregi("\r",$field) || eregi("\n",$field))
        {
        die(
    "Invalid Input!");
        }
    }
    if (!empty(
    $_POST))
    {
        
    $product_name $_POST['product_name'];
          
    checkOK($product_name);
        
    $product_class $_POST['product_class'];
          
    checkOK($product_class);
          
    $brand_name $_POST['brand_name'];
          
    checkOK($brand_name);
        
    $serial_num $_POST['serial_num'];
          
    checkOK($serial_num);
        
    $supplier_name $_POST['supplier_name'];
          
    checkOK($supplier_name);
        
    $unit_perbox $_POST['unit_perbox'];
          
    checkOK($unit_perbox);
        
    $total_box $_POST['total_box'];
          
    checkOK($total_box);
        
    $unit_cost_price $_POST['unit_cost_price'];
          
    checkOK($unit_cost_price);
        
    $product_description $_POST['product_description'];
          
    checkOK($product_description);
        
        
    $connectionstring =odbc_connect("hypermart","","");
        
    $query ="INSERT INTO product VALUES('','$product_class','$brand_name','$product_name','$serial_num','$unit_cost_price','$unit_perbox','$total_box','$supplier_name','product_description')";
        
    $queryexe =odbc_do($connectionstring$query);   // <---- Line 32
         
    if($queryexe)
            {
            
    header("location:testconnect.php");
            }
            else
            {
            echo 
    "Insert data failed!";
            } 
    }
    //odbc_close($connectionstring);
    ?>

  2. #2
    Join Date
    Jan 2005
    Posts
    362
    I noticed it with asp-access, There is a problem related with the properties of the connection and the recordset.
    http://www.w3schools.com/ado/default.asp
    Try the odbc_exec($conn,$sql); http://www.w3schools.com/php/php_db_odbc.asp - or other function.
    dimis

Posting Permissions

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