3 /*Parateterised Insert*/
5 $conn=odbc_connect('mycsql','root','manager');
8 echo "Connection Failed";
12 odbc_exec($conn,"CREATE TABLE t1(f1 INT, f2 CHAR(20),f3 int);");
13 odbc_exec($conn,"INSERT INTO t1 values(10,'ABCD',1);");
14 odbc_exec($conn,"INSERT INTO t1 values(20,'PQRS',2);");
16 $sth = 'SELECT * FROM t1;';
17 $rs = odbc_exec($conn, $sth);
20 echo "Error in SQL-2";
23 odbc_result_all($rs, 'border = 5');
25 $q = "INSERT INTO t1(f1,f2) values(?,?);";
26 $res = odbc_prepare ($conn, $q);
28 $exc = odbc_execute($res, array($a, $b));
34 $sth = 'SELECT * FROM t1;';
35 $rs = odbc_exec($conn, $sth);
36 odbc_result_all($rs, 'border = 5');
38 $sth=odbc_prepare($conn,"DROP TABLE t1;");
39 $res = odbc_execute($sth);
41 {exit("\nError in Drop Table");}
42 echo "\nTable Dropped \nTest Passed";