CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 ::: Detecting When MySQL Server Goes Down

Print topic Send  topic

Author Message
klwillis


Posts: 428
Posted: 07/29/2004, 8:07 PM

I receive the following message when attempting to
connect to the database, and the server is down:

pconnect(localhost:3306, mysqladmin, $DBPassword)

What's the nicest way to check if the server is down
and redirect to another page if this is the case.

It would be nice to avoid seeing this message. :)


_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
feha


Posts: 712
Posted: 08/01/2004, 4:02 AM

//BY www.vision.to

ini_set('display_errors', '0');
$link = mysql_connect("localhost", "user_name", "your_pass");
if (mysql_errno() == 1040 OR mysql_errno() == 1203 OR mysql_errno() > 0) {
define("DB_HOST", "xxxxxxxxx.com:3306");//YOU CAN PUT YOUR CONNECTION NAME BUT AS IT IS WORKS FINE
define("DB_NAME", "db2"); //database_name
define("DB_USER", "user_name_2"); //database user name
define("DB_PASSWORD","pass2"); //database (user) password
}
else
{
define("DB_HOST", "localhost");//YOU CAN PUT YOUR CONNECTION NAME BUT AS IT IS WORKS FINE
define("DB_NAME", "db1"); //database_name
define("DB_USER", "user_name"); //database user name
define("DB_PASSWORD","yourpass"); //database (user) password
}
mysql_close();
ini_set('display_errors', '1');
_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
klwillis


Posts: 428
Posted: 08/01/2004, 8:09 PM

Quote feha:
//BY www.vision.to

ini_set('display_errors', '0');
$link = mysql_connect("localhost", "user_name", "your_pass");
if (mysql_errno() == 1040 OR mysql_errno() == 1203 OR mysql_errno() > 0) {
define("DB_HOST", "xxxxxxxxx.com:3306");//YOU CAN PUT YOUR CONNECTION NAME BUT AS IT IS WORKS FINE
define("DB_NAME", "db2"); //database_name
define("DB_USER", "user_name_2"); //database user name
define("DB_PASSWORD","pass2"); //database (user) password
}
else
{
define("DB_HOST", "localhost");//YOU CAN PUT YOUR CONNECTION NAME BUT AS IT IS WORKS FINE
define("DB_NAME", "db1"); //database_name
define("DB_USER", "user_name"); //database user name
define("DB_PASSWORD","yourpass"); //database (user) password
}
mysql_close();
ini_set('display_errors', '1');

That's nice, but where is this bit of code placed? ;-)
_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
feha


Posts: 712
Posted: 08/03/2004, 5:11 AM

Check Your Common file
for DB connection
(I have modified mine but you can get an idea ...)

regards

_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.