<?php $link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
/* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s\n", maxdb_connect_error()); exit(); }
$query = "SELECT name, cno from hotel.customer ORDER BY cno";
if ($result = maxdb_query($link, $query)) {
/* Get field information for all columns */ $finfo = maxdb_fetch_fields($result); foreach ($finfo as $val) { printf("Name: %s\n", $val->name); printf("Table: %s\n", $val->table); printf("max. Len: %d\n", $val->max_length); printf("Flags: %d\n", $val->flags); printf("Type: %d\n\n", $val->type); } maxdb_free_result($result); }
/* close connection */ maxdb_close($link); ?>
|