3 /* Creating table with Primary key constraint constraint on the int field
4 check basic INSERT, SELECT */
6 $conn=odbc_connect('mycsql','root','manager');
9 echo "Connection Failed";
13 $sth = odbc_prepare($conn,"create table t1 (f1 int , f2 int, primary key(f1));");
14 $res = odbc_execute($sth);
17 echo "Error in Creation";
22 $sth = odbc_prepare($conn, "insert into t1 values (10, 20);");
23 $res = odbc_execute($sth);
26 echo "Error in Insertion";
29 echo "\nRecord Inserted\n";
31 $res = odbc_exec($conn, "insert into t1 values (10, 30);");
33 $sth = 'select * from t1;';
34 $rs = odbc_exec($conn, $sth);
37 echo "Error in SQL-2";
40 echo "\nselect executed\n";
43 $sth=odbc_prepare($conn,"DROP TABLE t1;");
44 $res = odbc_execute($sth);
47 echo "\nError in Drop Table";
50 echo "\nTable Dropped\nTest Passed\n";