#4538 [Com]: Error with odbc_exec and an Insert query

From: Date: Fri, 13 Aug 2004 23:22:48 +0000
Subject: #4538 [Com]: Error with odbc_exec and an Insert query
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-64587@lists.php.net to get a copy of this message
ID: 4538 Comment by: anand_immer at yahoo dot fr Reported By: guillaume dot patry at netcourrier dot com Status: Closed Bug Type: ODBC related Operating System: Windows2000 Pro PHP Version: 4.0 Release Candidate 1 New Comment: This could rather be a case of access (authorisation) to database for writing; you have to check this and ALSO the rights you have fixed for each folder including the database. You must share each folder where your application is put (not just the web sharing but the mere sharing of a folder, like you do for transfers between two computers in a LAN) and then try and see if the insert works. Previous Comments: ------------------------------------------------------------------------ [2000-06-20 11:15:42] kara at cvs dot php dot net Either use $AddPrepare = odbc_prepare($odbc, $SQL_Insert); odbc_execute($AddPrepare); or $res = odbc_exec($odbc, $SQL_Insert); Additionally, your odbc_commit() is bogus. You are normally in autocommit mode, meaning your statements are automatically commited on success. If you were in manual commit mode, you should check the result of odbc_execute() / odbc_exec() and then commit / rollback, not the result of odbc_prepare() ------------------------------------------------------------------------ [2000-05-22 05:09:05] guillaume dot patry at netcourrier dot com my php script : --------------- $idCon = odbc_connect("DataWeb","","", SQL_CUR_USE_ODBC); $SQL_Insert = "INSERT INTO Users (name, firm, username, password, email) VALUES ('$nom', '$firm', '$login', '$pass', '$mail')"; $AddPrepare = odbc_prepare($odbc, $SQL_Insert); if ($AddPrepare) { $QueryAdd = odbc_exec($odbc, $SQL_Insert); odbc_commit($odbc); } else echo "Error on The Serveur <br>"; } The Error Message : ------------------- Warning: SQL error: [Microsoft][Pilote ODBC Microsoft Access] L'opération doit utiliser une requête qui peut être mise à jour., SQL state S1000 in SQLExecute in C:\Inetpub\wwwroot\php\register.php on line 123 Warning: SQL error: , SQL state 00000 in SQLExecute in C:\Inetpub\wwwroot\php\register.php on line 123 Configuration : --------------- I use Windows2000 pro with php4 and IIS 5. All the select queries works but the Insert Into dosen't work... My php.ini file is OK, i don't have make any changes on it. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=4538&edit=1

« previous php.bugs (#64587) next »