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