<?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 zip, name FROM hotel.city ORDER by name";
if ($stmt = maxdb_prepare($link, $query)) {
/* execute statement */
maxdb_stmt_execute($stmt);
/* bind result variables */
maxdb_stmt_bind_result($stmt, $name, $code);
/* fetch values */
while (maxdb_stmt_fetch($stmt)) {
printf ("%s (%s)\n", $name, $code);
}
/* close statement */
maxdb_stmt_close($stmt);
}
/* close connection */
maxdb_close($link);
?>