moving server source files to server folder
[csql.git] / test / phptests / parainsert.php
blobbbe94ad14297193bbb9530784c5a61ad3aa1533c
1 <html>
2 <body>
3 /*Parateterised Insert*/
4 <?php
5 $conn=odbc_connect('mycsql','root','manager');
6 if (!$conn)
8 echo "Connection Failed";
9 exit(1);
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);
18 if (!$rs)
20 echo "Error in SQL-2";
21 exit(2);
23 odbc_result_all($rs, 'border = 5');
25 $q = "INSERT INTO t1(f1,f2) values(?,?);";
26 $res = odbc_prepare ($conn, $q);
27 $a = 30; $b = "PPPP";
28 $exc = odbc_execute($res, array($a, $b));
29 if (!$rs)
31 exit(3);
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);
40 if (!$res)
41 {exit("\nError in Drop Table");}
42 echo "\nTable Dropped \nTest Passed";
43 odbc_close($conn);
46 </body>
47 </html>