<?php
/* Open a connection */
$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, zip FROM hotel.city ORDER BY name";
if ($stmt = maxdb_prepare($link, $query)) {
/* execute query */
maxdb_stmt_execute($stmt);
/* bind result variables */
maxdb_stmt_bind_result($stmt, $name, $code);
/* store result */
maxdb_stmt_store_result($stmt);
/* seek to row no. 5 */
maxdb_stmt_data_seek($stmt, 5);
/* fetch values */
maxdb_stmt_fetch($stmt);
printf ("City: %s Zip: %s\n", $name, $code);
/* close statement */
maxdb_stmt_close($stmt);
}
/* close connection */
maxdb_close($link);
?>