1
I created a php block and was doing some testing. I simulated it being unable to access a database in MySQL that is unrelated to xoops. I wanted it to display a default message indicating the table was unavailable. I loaded the page, and found the default message there. However, I also saw that the login and user menu blocks, located in a separate region (left) were both empty. Their titles were there, but there was no spot to login (for anonymous users), and no way to access the user menu (for registered users). I moved a couple of multimenu blocks to the front page, and they worked fine, as did all other blocks. It only appears the system blocks were affected. Why would this happen? The php code for my block is:
$dbcnx = @mysql_connect("localhost", "username", "password"); // this user doesn't have access
if (!$dbcnx) {
echo( "
No Information for Today!!!
" ); //Executed, since it didn't connect
}
if (! @mysql_select_db("MyTable") ) { // Should fail, since it didn't connect
echo( "
Unable to locate the " .
"database at this time.
" );
}
$sql = 'SELECT * MyTable';
$result = mysql_query($sql);
if (!$result) {
echo("
Error performing query: " .
mysql_error() . "
");
}
$htoutput = "
".
"".
"Item 1 | ".
"Item 2 | ".
"Item 3 | ".
"
";
echo($htoutput);
$i=0;
while ( ($row = mysql_fetch_array($result)) and ($i<5) ) {
// process the row...
$htoutput = "".
"" . $row["Item1"] . " | ".
"" . $row["Item2"] . " | ".
"" . $row["Item3"] . " | ".
"
";
echo($htoutput);
$i = $i + 1;
}
echo("
");
echo("
Updated daily at 7:00 pm Eastern
");