<?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, state FROM hotel.city ORDER by zip";
if ($result = maxdb_query($link, $query)) {
/* fetch object array */
while ($obj = maxdb_fetch_object($result)) {
printf ("%s (%s)\n", $obj->NAME, $obj->STATE);
}
/* free result set */
maxdb_free_result($result);
}
/* close connection */
maxdb_close($link);
?>