3 /* Creating table with not null 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 not null, f2 int);");
14 $res = odbc_execute($sth);
17 echo "Error in Creation";
20 echo "Table Created\n";
22 $res = odbc_exec($conn, "insert into t1 values (10, 20);");
26 echo "Error in Insertion";
29 echo "\nRecord Inserted\n";
31 $res = odbc_exec($conn,"insert into t1 values (null, 20);");
33 $sth = 'select * from t1;';
34 $rs = odbc_exec($conn, $sth);
37 echo "Error in SQL-2" ;
40 echo "\nselect executed\n";
43 echo "<th>F2</th></tr>";
44 echo "\nfetch started\n";
45 while (odbc_fetch_row($rs))
47 $roll=preg_replace('/[\x00-\x09\x0B-\x19\x7F]/', '',odbc_result($rs, 1));
48 $name=preg_replace('/[\x00-\x09\x0B-\x19\x7F]/', '',odbc_result($rs, 2));
49 echo "<tr><td>$roll</td>";
50 echo "<td>$name</td></tr>\n";
54 $sth=odbc_prepare($conn,"DROP TABLE t1");
55 $res = odbc_execute($sth);
58 echo "\nError in Drop Table";
61 echo "\nTable Dropped\nTest Passed";