Welcome to Geeklog, Anonymous Friday, May 03 2024 @ 03:22 am EDT

Geeklog Forums

Change message "No Mysql connection"


Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
When there is a problem with mysql server the following message is displayed :
Warning: mysql_connect(): Too many connections in /home/ecologie/system/databases/mysql.class.php on line 112
Cannnot connect to DB server


What mod can we do to display a nice page to inform the visitors that the problem will be solve as soon as possible?

Ben.
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
In system/databases/mysql.class.php find this line:
Text Formatted Code
// Connect to MySQL server
$this->_db = mysql_connect($this->_host,$this->_user,$this->_pass) or die('Cannnot connect to DB server');
 

The "Warning:" probably comes from the mysql_connect and can be suppressed by putting an @ sign in front of it. And then you could replace the die() text with whatever you prefer.

Text Formatted Code
$this->_db = @mysql_connect($this->_host,$this->_user,$this->_pass) or die('Oops, sorry. Please try again in a few minutes.');
 

bye, Dirk
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Thanks a lot mister Dirk.

Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
A redirection to another page is possible. Replace

Text Formatted Code
die('Cannnot connect to DB server');

by

header("Location: http://www.mysite.com/page.html");


 



Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

All times are EDT. The time is now 03:22 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content