<?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 associative array */
while ($row = maxdb_fetch_assoc($result)) {
printf ("%s (%s)\n", $row["NAME"], $row["STATE"]);
}
/* free result set */
maxdb_free_result($result);
}
/* close connection */
maxdb_close($link);
?>