<?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 fields */
while ($finfo = maxdb_fetch_field($result)) {
/* get fieldpointer offset */
$currentfield = maxdb_field_tell($result);
printf("Column %d:\n", $currentfield);
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n\n", $finfo->type);
}
maxdb_free_result($result);
}
/* close connection */
maxdb_close($link);
?>