1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

UPDATE query is not working

Discussion in 'Software Development' started by Sujit Joshi, Jul 4, 2005.

Thread Status:
Not open for further replies.
Advertisement
  1. Sujit Joshi

    Sujit Joshi Thread Starter

    Joined:
    Jun 24, 2005
    Messages:
    18
    hello all,
    i'm using PHP and MS ACCESS database now i'm updating the table in a while loop. but it is giving error like...

    Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement., SQL state 37000 in SQLExecDirect in c:\apache\htdocs\allocater.php

    and my update query is look like this....
    $update = "UPDATE allocate3 SET WORKSHEDULE='$work',TIME='$now_date' WHERE auto_id='$id'";
    $sql_result = odbc_exec($conn,$update);

    what may be the problem please help me regarding this????
     
  2. GCDude

    GCDude

    Joined:
    Apr 1, 2005
    Messages:
    394
    run the update query in access, it should give you a better error message. But as a first guess i would say its your "auto_id='$id'" im assuming the auto_id is an AutoNumber or Number so it shouldnt have single quotes around the val "auto_id=$id"
     
  3. Sujit Joshi

    Sujit Joshi Thread Starter

    Joined:
    Jun 24, 2005
    Messages:
    18
    yes you are correct "auto_id" is AutoNumber. i'll try taking out the quotes around the value of auto_id. but i think that is not the problem....
     
  4. Mithrilhall

    Mithrilhall

    Joined:
    Mar 28, 2001
    Messages:
    781
    Try writing your SQL string to the browser before actually attempting to update the DB.

    Are the values you expected in it?
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/377743