3 /*Autoincrement testing */
5 $conn=odbc_connect('mycsql','root','manager');
8 echo "Connection Failed";
12 $sth = odbc_prepare($conn,"CREATE TABLE t1(f1 INT auto_increment, f2 CHAR(20));");
13 $res = odbc_execute($sth);
20 $sth = odbc_prepare($conn, "INSERT INTO t1(f2) VALUES('One');");
21 $res = odbc_execute($sth);
26 echo "\nINSERT INTO t1(f2) VALUES('One');";
27 echo "\nRecord Inserted";
29 $sth = odbc_prepare($conn, "INSERT INTO t1(f1,f2) VALUES(5,'Five');");
30 $res = odbc_execute($sth);
35 echo "\nINSERT INTO t1(f1,f2) VALUES(5,'Five');";
36 echo "\nRecord Inserted";
38 $sth = odbc_prepare($conn, "INSERT INTO t1(f2) VALUES('Six');");
39 $res = odbc_execute($sth);
44 echo "\nINSERT INTO t1(f2) VALUES('Six');";
45 echo "\nRecord Inserted";
47 $sth = odbc_prepare($conn, "INSERT INTO t1(f1,f2) VALUES(3,'Three');");
48 $res = odbc_execute($sth);
53 echo "\nINSERT INTO t1(f1,f2) VALUES(3,'Three');";
54 echo "\nRecord Inserted";
56 $sth = odbc_prepare($conn, "INSERT INTO t1(f2) VALUES('Seven');");
57 $res = odbc_execute($sth);
62 echo "\nINSERT INTO t1(f2) VALUES('Eight');";
63 echo "\nRecord Inserted\n";
65 $sth = 'select * from t1;';
66 $rs = odbc_exec($conn, $sth);
71 echo "\nselect executed\n";
73 $sth=odbc_prepare($conn,"DROP TABLE t1;");
74 $res = odbc_execute($sth);
79 echo "\nTable Dropped \nTest Passed";