<?php
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (maxdb_connect_errno()) {
printf("Connect failed: %s\n", maxdb_connect_error());
exit();
}
/* return name of current default database */
if ($result = maxdb_query($link, "SELECT SERVERDB FROM USERS WHERE USERNAME='MONA'")) {
$row = maxdb_fetch_row($result);
printf("Default database is %s.\n", $row[0]);
maxdb_free_result($result);
}
/* change db to non existing db */
maxdb_select_db($link, "XXXXXXXX");
/* return name of current default database */
if ($result = maxdb_query($link, "SELECT SERVERDB FROM USERS WHERE USERNAME='MONA'")) {
$row = maxdb_fetch_row($result);
printf("Default database is %s.\n", $row[0]);
maxdb_free_result($result);
}
maxdb_close($link);
?>