windows porting changes
[csql.git] / test / phptests / paraupdate.php
blob838e35fde81003c69c7f19ed612daf2f947b6f4a
1 <html>
2 <body>
3 /*Parameterisez update*/
4 <?php
5 $conn=odbc_connect('mycsql','root','manager');
6 if (!$conn)
8 echo "Connection Failed ";
9 exit(1);
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);
19 if (!$rs)
21 echo "Error in SQL-2";
22 exit(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);
29 $a = "PPPP"; $b=10;
30 $exc = odbc_execute($res, array($a, $b));
31 if (!$rs)
33 exit(3);
36 $sth = 'SELECT * FROM t1;';
37 $rs = odbc_exec($conn, $sth);
38 if (!$rs)
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);
44 if (!$res)
45 {exit("\nError in Drop Table");}
46 echo "\nTable Dropped \nTest Passed";
47 odbc_close($conn);
50 </body>
51 </html>