Testing MySQL Database Connection





5
Date Submitted Fri. Aug. 25th, 2006 3:50 AM
Revision 1 of 1
Helper Cyber-Drugs
Tags ??? | die | if | mysql_connect | mysql_error | phpcode
Comments 0 comments
Below is a very simple bit of code you can use to test a MySQL Database Connection.

<?php
$conn = mysql_connect("localhost", "username", "password") or die(mysql_error());
if ($conn) echo "Connect successfull"
?>
 

Justin Nel

Comments

There are currently no comments for this snippet.

Voting