3 /*Parameterisez update*/
5 $conn=odbc_connect('mycsql','root','manager');
8 echo "Connection Failed ";
12 $result = odbc_exec($conn,"CREATE TABLE t1(f1 INT, f2 CHAR(20),f3 int);");
13 $result = odbc_exec($conn,"INSERT INTO t1 values(10,'ABCD',1);");
14 $result = odbc_exec($conn,"INSERT INTO t1 values(20,'PQRS',2);");
16 odbc_free_result($result);
17 $sth = 'SELECT * FROM t1;';
18 $rs = odbc_exec($conn, $sth);
21 echo "Error in SQL-2";
24 odbc_result_all($rs, 'border = 5');
25 odbc_free_result($rs);
27 $q = "update t1 set f2=? where f1=?";
28 $res = odbc_prepare ($conn, $q);
30 $exc = odbc_execute($res, array($a, $b));
36 $sth = 'SELECT * FROM t1;';
37 $rs = odbc_exec($conn, $sth);
39 {exit("Error in SQL-2");}
40 odbc_result_all($rs, 'border = 5');
42 $sth=odbc_prepare($conn,"DROP TABLE t1;");
43 $res = odbc_execute($sth);
45 {exit("\nError in Drop Table");}
46 echo "\nTable Dropped \nTest Passed";