Made an error in the first script (forgot to update one field)... find
the correction below...
---------------------------
Hi,

I've been working on some of the bugs for ODBC in the bugs db, mainly
those dealing with Windows and ODBC. 

One of the common bugs seems to be using odbc_prepare() and
odbc_execute() in conjuction with each other.  I was hoping someone
might be able to do an ODBC test case for me, on something other than
Microsoft Access (which is all I have MS wise).  

Two tables should be created, odbcetest1 and odbctest2.  Any writes in
this script to odbctest1 should fail, but I believe odbctest2 should
work fine.  If anyone can send me some results confirming or denying my
theory, they would be appriciated.  :)



<? 

//
// this is just a quick and dirty proof of concept script
//

//
// please setup this script to connect to your database
//
$conn = odbc_connect("phptest","","");
if (!$conn)
{
        print "Error in connecting<BR>\n";
        exit;
}

odbc_exec($conn,"DROP TABLE odbctest1"); 
odbc_exec($conn,"CREATE TABLE odbctest1 (id INT, firstname CHAR(24),
lastname CHAR(24))");    
odbc_exec($conn,"DROP TABLE odbctest2"); 
odbc_exec($conn,"CREATE TABLE odbctest2 (id CHAR(2), firstname CHAR(24),
lastname CHAR(24))");    
odbc_exec($conn,"INSERT INTO odbctest1 (id,firstname,lastname) VALUES
(0,'Zend','PHP')");
odbc_exec($conn,"INSERT INTO odbctest2 (id,firstname,lastname) VALUES
('99','Apache','Origami')");

$stmt1 = odbc_prepare($conn,"INSERT INTO odbctest1
(id,firstname,lastname) VALUES (?,?,?)");
if ($stmt1) {
        print "Trying execute stat1<br>";
        $stmt1 = odbc_execute($stmt1,array(1,"This","Fails"));
}

$stmt2 = odbc_prepare($conn,"INSERT INTO odbctest2
(id,firstname,lastname) VALUES (?,?,?)");
if ($stmt2) {
        print "Trying execute stat2<br>";
        $stmt2 = odbc_execute($stmt2,array("1","This","Works"));
}
        
?>


-- 
Dan Kalowsky                  "Tonight I think I'll walk alone, 
Worldgate Communications       I'll find my soul as I go home."
Software Engineer - TICS Group          - Temptation
[EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to