windows porting changes
[csql.git] / test / phptests / columninfo1.php
blob35c6bd9cea36241180cba4e4dc9277f05a276464
1 <html>
2 <body>
3 /*Testing odbc_field_num for find the field position of a field */
4 <?php
5 $conn=odbc_connect('mycsql','root','manager');
6 if (!$conn)
8 echo "Connection Failed";
9 exit(1);
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);
15 if (!$res)
17 echo "Error in Creation";
18 exit(2);
20 echo "Table Created\n";
22 $sql = "SELECT * FROM t1";
23 $result = odbc_exec($conn, $sql);
24 $rs = odbc_field_num($result, "f6");
25 if (!$rs)
27 exit(3);
29 echo "\nPosition of column f6 is ";
30 echo $rs ;
31 echo "\n";
33 $sth=odbc_prepare($conn,"DROP TABLE t1;");
34 $res = odbc_execute($sth);
35 if (!$res)
36 {exit("\nError in Drop Table");}
37 echo "\nTable Dropped \nTest Passed";
38 odbc_close($conn);
41 </body>
42 </html>