Jump to content

Recommended Posts

Hi I'm new to php. At present I have some Information on a home page with internal (including a link to my forums) and external links. I would also like to show the status of the mySQL database status. I.e. if the Database is running or not. If not I'd like a message to be shown (not a popup).

 

Examples I've seen include having the database details but obviously I don’t want to expose these details to robots etc.

 

Any help appreciated :D

 

Regards

Darren

 

Welcome!

 

The best way I'd do this is to try and establish a connection but disable the error reporting and handle any failure myself.

 

if (@mysql_connect($server,$user,$pass)) {
  $dbisonline=true;
} else {
  $dbisonline=false;
}

 

The @ in front of mysql_connect() prevents any error messages being sent to the browser.

Yes because those details will be inside a PHP file which can't be downloaded by a user unless they have FTP access.

 

A browser accessing a PHP file will only view what they generate. If it doesn't output anything to the browser then all they'll get back is an empty page.

ok, Still cannot graasp it maybe is bcause I have been coding all day in VB and I'm just missing something  :)

 

doing the example with my page as index.php I can do with no problem.

however I need my html page to execute the php and show the status of the forum.

Have a look at www.guild-madness.co.uk on the right side there is a forum status bit. Here is where I want to show Forums: Running or Forums: Down ~ Please try again later.

 

If I understand correctly I need to show the index.php which has my html and then when I need to execute the php just put <?php do something ?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.