News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Error handling and SSI.php

Started by bulliedog, June 22, 2004, 05:19:56 PM

Previous topic - Next topic

bulliedog

I am using SSI.php to include recent forum posts on the main page of my site (not the forum index).  On rare occasions my MYSQL server fails or SMF is unable to connect to the DB for some reason.  When this occurs I get an error message when trying to access my main site page (or any other page that uses SSI.php for that matter) - just the standard one line on white background.

Is there some way that I can code error handling into my pages to just ignore the errors if the DB is not available and just output the rest of the page?

James

[Unknown]

Good idea, it can just return with nothing... hmm...

-[Unknown]

bulliedog

Quote from: [Unknown] on June 22, 2004, 05:36:04 PM
Good idea, it can just return with nothing... hmm...

-[Unknown]

Are you "hmmm-ing" because you are thinking that this should be implemented or because you think this should be very easy to do and I should just do it myself ???

[Unknown]


bulliedog

Okay, so I am back to trying to figure this out again.  I have found that I can change the E_ALL in SSI.PHP to a 0 to prevent the error message from showing but then I just get a blank page.

I should be able to come up with some sort of redirect to a page that tells the user that we are experiencing temporary problems and to try back later or similar right?  Would I (better yet, should I?) include this change into SSI.PHP or is there a better way?


[Unknown]


bulliedog

Glad I checked this thread again.  :)  I haven't had time to even try what I was planning to do but if RC1 is gonna do this for me, I think I'll just wait.  I can live with what I have now as long as RC1 is in my near future  ;)

bulliedog

I haven't yet installed RC1 - probably this weekend, but can someone tell me exactly what happens with SSI.PHP then when you are using it on page and it is not able to get the data? (DB problem or whatever).

Thanks.

[Unknown]

if ($db_connection === false || @mysql_select_db($db_name, $db_connection) == false)
return false;


Or, in other words:

if (false !== include_once('SSI.php'))
   echo 'Connection successful!';
else
   echo 'Cannot connect :/.';

Or similar.... maybe using a variable.  I know PHP has bugs to do with the result of include_once...

-[Unknown]

Advertisement: