php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10484 Problem with insert in ODBC
Submitted: 2001-04-25 00:27 UTC Modified: 2001-04-26 00:16 UTC
From: Domlane at hotmail dot com Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.4pl1 OS: Win2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: Domlane at hotmail dot com
New email:
PHP Version: OS:

 

 [2001-04-25 00:27 UTC] Domlane at hotmail dot com
$BD = odbc_connect ('BdTest', SQL_CUR_USE_DRIVER);
$SQL = "insert into test values ('a', 'b')";
$TabUser = odbc_exec($BD, $SQL);

this don't work...nothing had been added in the table test


$BD = odbc_connect ('BdTest '', SQL_CUR_USE_DRIVER);
$SQL = "select * from Utilisateur where Nom_utilisateur = '$Nom' and Mot_de_passe = '$Pass'";
 $TabUser = odbc_exec($BD, $SQL);

This work fine!


How should i use "insert" statement in order to make it works??

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-25 10:08 UTC] kalowsky@php.net
unless I'm missing something your INSERT statement is not correct.
 [2001-04-25 10:17 UTC] Domlane at hotmail dot com
Yes it is correct!

As there only are two fields in my table and that I try to fill them all, I can work it this way

I could have use "INSERT INTO test (field1, field2) VALUES ('a', 'b')"

"INSERT INTO test VALUES ('a', 'b')" work the same way
 [2001-04-25 10:36 UTC] kalowsky@php.net
you're correct insert statement is fine, needed more wake up time on that.

your odbc_connect is wrong.  you need to provide 3 or 4 parameters, not just two.  as per the description found at:
http://www.php.net/manual/en/function.odbc-connect.php


 [2001-04-25 11:32 UTC] Domlane at hotmail dot com
$BD = odbc_connect ('BdTest', SQL_CUR_USE_DRIVER);

should be read like $BD = odbc_connect ('BdTest', '', '', SQL_CUR_USE_DRIVER);


but still not working..
 [2001-04-26 00:03 UTC] Domlane at hotmail dot com
Found the solution!!

Have to change security on my DB.mdb file to allow internet user to modify my file!

Thanks!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 02:01:28 2025 UTC