php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4538 Error with odbc_exec and an Insert query
Submitted: 2000-05-22 05:09 UTC Modified: 2000-06-20 11:16 UTC
From: guillaume dot patry at netcourrier dot com Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0 Release Candidate 1 OS: Windows2000 Pro
Private report: No CVE-ID: None
 [2000-05-22 05:09 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-20 11:15 UTC] 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()

 [2004-08-14 01:22 UTC] anand_immer at yahoo dot fr
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Dec 04 22:00:01 2025 UTC