Name.com Cyber Monday sale: $6.99 .com domains and more. Shop the sale.

HostDens.Com : PHP Script to check Database Connection

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch
Status
Not open for further replies.

wRick

Established Member
Impact
0
HostDens.Com : PHP Script to check Database Connection from browser

It is simple task to check database connectivity from the browser it self and it’s not necessary to logged into server.

Yes, but you should be knowing host-name, password and user

<?php
mysql_connect(‘db_host’, ‘db_username’, ‘password’) or die(‘Could not connect the database : Username or password incorrect’);
mysql_select_db(‘db_name’) or die (‘No database found’);
echo ‘Database Connected successfully';
?>

It’s very simple concept, first the “mysql_connect” argument will check the database hostname, username and password. If the first argument is true, then PHP take the second line to execute else the script will die with an output given in the Die section. Similarly, mysql_select_db check the database on the server. If both of the arguments are true then you will get an output given after the echo command.

Example:

1, If all of the input data(db_name, username, password, hostname) are right, then the output is like;

Database Connected successfully

2, If any of the entry in ‘mysql_connect’ section is wrong, then the output is;

Could not connect the database : Username or password incorrect

3, If the database entry is wrong;

No database found

Thank you for reading !!!

██ HostDens.com : Enjoy Unlimited Web Hosting | Beyond Your Expectation
██ Reseller Hosting| VPS Servers (Windows, Linux) | Shared Hosting
██ $1 Hosting | Affordable Shared Web Hosting Services​
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Status
Not open for further replies.
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

New: watch any domain
You can now watch domains on NamePros. We check each one and notify you when something changes. Search for a domain and press Watch on...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back