1
DerekM
Please if possible
  • 2003/11/13 12:16

  • DerekM

  • Just popping in

  • Posts: 13

  • Since: 2003/7/22


Our host sometimes has problems with the Database of our server. Is there anyway that you can make all the connect to database tags if it doesn't connect display a page. That we can customize not text deep in the code. Please look in to this if possible.

Thanks
Derek

BTW this is the error i have -
This page cannot be displayed due to an internal error.

If 
you are the administrator of this siteplease visit the XOOPS Troubleshooting Page for assistance.

Warning [PHP]: mysql_connect(): Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (2) in file class/database/mysqldatabase.php line 74
Error [Xoops]: Unable to connect to database in file class/database/databasefactory.php line 34

2
svaha
Re: Please if possible
  • 2003/11/13 13:04

  • svaha

  • Just can't stay away

  • Posts: 896

  • Since: 2003/8/2 2


If I understand you well, then what you want is :
Display a user friendly page/message in case of an error?

Aloha

3
DerekM
Re: Please if possible
  • 2003/11/13 20:23

  • DerekM

  • Just popping in

  • Posts: 13

  • Since: 2003/7/22


well, yes, thats a good way to explain it. but how do i do that

4
mvandam
Re: Please if possible
  • 2003/11/13 21:22

  • mvandam

  • Quite a regular

  • Posts: 253

  • Since: 2003/2/7 2


Quote:

This page cannot be displayed due to an internal error.If you are the administrator of this site, please visit the XOOPS Troubleshooting Page forassistance.Warning [PHP]: mysql_connect(): Can't connect to local MySQL server through socket'/var/tmp/mysql.sock' (2) in file class/database/mysqldatabase.php line 74Error [Xoops]: Unable to connect to database in file class/database/databasefactory.php line 34

I guess the easiest way is to find the text in class/errorhandler.php which says "This page cannot be displayed..." and change it to what you want. Also turn off debugging in preferences to get rid of the Warning messages etc. If you want to do this ONLY for database errors, this is a little trickier, but you can check through the error messages (in the error handler) and see if any contains the string "mysql_connect"... if so, display your desired text/html and if not, leave it as is.

5
svaha
Re: Please if possible
  • 2003/11/13 22:52

  • svaha

  • Just can't stay away

  • Posts: 896

  • Since: 2003/8/2 2


In this case you could look for something like this :

Quote:
<?php
/* Connecting, selecting database */
$link = mysql_connect("mysql_host", "mysql_user", "mysql_password")
or die("Could not connect : " . mysql_error());
print "Connected successfully";
mysql_select_db("my_database") or die("Could not select database");



And replace the existing text with a more user friendly text.

Aloha

Login

Who's Online

198 user(s) are online (130 user(s) are browsing Support Forums)


Members: 0


Guests: 198


more...

Donat-O-Meter

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

Latest GitHub Commits