Click to See Complete Forum and Search --> : default "maintenance" page


MarySunshine
10-17-2003, 05:26 PM
:confused:
I know there has to be a simple way to do this, but I can't figure it out! I am modifying someone else's coding...

I maintain a catalogue of product, and update the database frequently. From time to time, I need to rebuild the DB and during that process the following message is displayed:

Table 'dbname.tablename' doesn't exist

I would rather that a more understandable message displayed... something like "Current Time: Thank you for coming by. The catalogue is currently being updated, please come back later"

Is this possible? Can anyone help me please?

Jona
10-17-2003, 07:05 PM
Somewhere in the code it is probably using a mysql_error() to report the error. Simply remove that, and replace it with echo("Currently the database is being updated. Please return at a later time."); exit; so that no more errors are reported afterthat... Unless you have includes files (in PHP code) or other things that you want to keep on there. (In which case, you would include it after you echo'd what you wanted to say, and then exit.)

[J]ona

MarySunshine
10-17-2003, 08:44 PM
Thanks! Okay, so if I understand correctly.. I will want to change this bit of coding:

<?php
$rst=$ssc->Execute("SELECT Consultant.*, Theme.filename FROM Consultant LEFT OUTER JOIN Theme ON Consultant.themeID=Theme.themeID WHERE consultantID = " . ($rst__MMColParam) . "") or DIE($ssc->ErrorMsg());
$rst_numRows=0;
$rst__totalRows=$rst->RecordCount();
?>

To:

<?php
$rst=$ssc->Execute("SELECT Consultant.*, Theme.filename FROM Consultant LEFT OUTER JOIN Theme ON Consultant.themeID=Theme.themeID WHERE consultantID = " . ($rst__MMColParam) . "") or DIE($ssc->echo("Currently the catalogue is being updated. Please return at a later time.");
$rst_numRows=0;
$rst__totalRows=$rst->RecordCount();
?>

Is that correct? Will that work?

Jona
10-17-2003, 08:48 PM
Yes, that looks like it should work.

[J]ona

MarySunshine
10-17-2003, 09:28 PM
Thanks Jona...

But alas, it does not work! I used that code, and (without rebuilding the db, simply viewing the page) came up with a big white screen.

Any other ideas?

Jona
10-17-2003, 09:33 PM
Try taking off the $ssc-> part...

[J]ona

MarySunshine
10-17-2003, 10:26 PM
Still not working... just a white screen.

:confused:

PunkSktBrdr01
10-17-2003, 10:29 PM
Try making changing "DIE(..." to "die(...".

Jona
10-17-2003, 10:30 PM
Try this...


<?php
$rst=$ssc->Execute("SELECT Consultant.*, Theme.filename FROM Consultant LEFT OUTER JOIN Theme ON Consultant.themeID=Theme.themeID WHERE consultantID = " . ($rst__MMColParam) . "");
if(!$rst){
echo("Currently the catalogue is being updated. Please return at a later time."); exit;
}
$rst_numRows=0;
$rst__totalRows=$rst->RecordCount();
?>


[J]ona

MarySunshine
10-17-2003, 11:00 PM
Bingo! Thanks!!!!

Now, I wonder if I can get a time stamp in there too? I don't think that is possible, though, is it?

Jona
10-17-2003, 11:04 PM
It's probably possible. What exactly do you mean? You can use the PHP date() function to display the current date, if that's what you mean.

[J]ona

MarySunshine
10-17-2003, 11:07 PM
I can? In an echo tag???

(I guess you can see I am still fairly low on the PHP learning curve, eh?)

Thanks so much for your help!

Jona
10-17-2003, 11:11 PM
$date = date("m-w-Y");
$rst=$ssc->Execute("SELECT Consultant.*, Theme.filename FROM Consultant LEFT OUTER JOIN Theme ON Consultant.themeID=Theme.themeID WHERE consultantID = " . ($rst__MMColParam) . "");
if(!$rst){
echo("Currently the catalogue is being updated. Please return at a later time. Today's date (month, day, year) is ". $date); exit;
}
$rst_numRows=0;
$rst__totalRows=$rst->RecordCount();


[J]ona

MarySunshine
10-17-2003, 11:37 PM
Wonderful!

You have truly done your good deed for the day. Here is the final code. I am very very pleased!

<?php
$date = date("l M dS, Y -- H:i:s");
$rst=$ssc->Execute("SELECT Consultant.*, Theme.filename FROM Consultant LEFT OUTER JOIN Theme ON Consultant.themeID=Theme.themeID WHERE consultantID = " . ($rst__MMColParam) . "");
if(!$rst){
echo("<center><small>. $date</small><hr><b>USBORNE BOOKS IN CANADA ~ online catalogue</b><p>Currently the catalogue is being updated...<br>
It shouldn't take very long though, so be sure come back in a bit. </center>"); exit;
}
$rst_numRows=0;
$rst__totalRows=$rst->RecordCount();
?>

Jona
10-18-2003, 12:39 AM
You are very, very welcome!! :)

[J]ona