Block Interferes with Login/User Menu
  • 2007/5/16 19:53

  • ccdoss

  • Just popping in

  • Posts: 9

  • Since: 2006/12/21

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( "<P>No Information for Today!!!</P>" ); //Executed, since it didn't connect
if (! @mysql_select_db("MyTable") ) { // Should fail, since it didn't connect
echo( "<P>Unable to locate the " .
"database at this time.</P>" );
$sql = 'SELECT * MyTable';
$result = mysql_query($sql);
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");

$htoutput = "<table>".
"<td><b>Item 1</b></td>".
"<td><b>Item 2</b></td>".
"<td><b>Item 3</b></td>".

while ( ($row = mysql_fetch_array($result)) and ($i<5) ) {
// process the row...
$htoutput = "<tr>".
"<td>" . $row["Item1"] . "</td>".
"<td>" . $row["Item2"] . "</td>".
"<td>" . $row["Item3"] . "</td>".
$i = $i + 1;
echo("<p>Updated daily at 7:00 pm Eastern</p>");



Lost Password? Register now!

Who's Online

57 user(s) are online (33 user(s) are browsing Support Forums)

Members: 0

Guests: 57



Goal: $100.00
Due Date: Jun 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits