<?php
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (!$link) {
printf("Connect failed: %s\n", maxdb_connect_error());
exit();
}
if ($result = maxdb_query($link, "SELECT * FROM dual")) {
$row = maxdb_fetch_row($result);
printf("Result: %s\n", $row[0]);
maxdb_free_result($result);
}
/* reset all and select a new database */
if (!maxdb_change_user($link, "DBADMIN", "SECRET", "DEMODB")) {
printf("Database not running\n");
} else {
printf("Database running\n");
}
/* close connection */
maxdb_close($link);
?>