5 $conn=odbc_connect('mycsql','root','manager');
8 echo "Connection Failed";
12 //$sth = odbc_prepare($conn,"CREATE TABLE t1(f1 INT, f2 CHAR(20),primary key(f1));");
13 $sth = odbc_prepare($conn,"CREATE TABLE t1(f1 INT, f2 CHAR(20),f3 SMALLINT,f4 BIGINT,f5 FLOAT, f6 DOUBLE,f7 DATE, f8 TIMESTAMP );");
14 $res = odbc_execute($sth);
17 echo "Error in Creation";
20 echo "Table Created\n";
22 $sql = "SELECT * FROM t1";
23 $result = odbc_exec($conn, $sql);
25 echo "\nTesting odbc_field_name() for find out column_name\n";
26 for ($col=0; $col<odbc_num_fields($result); $col++
)
28 $rs = odbc_field_name($result, $col);
31 echo "Error in Creation";
34 printf(" Column %d is %s\n" ,$col,odbc_field_name($result, $col));
37 $sth=odbc_prepare($conn,"DROP TABLE t1;");
38 $res = odbc_execute($sth);
40 {exit("\nError in Drop Table");}
41 echo "\nTable Dropped \nTest Passed";