User Tools

Site Tools


mysql_connection_test_script

Mysql Connection Test script

| mytest.php
<?php
$db_name = Database Name;
$db_user = Database User;
$db_pass = Database password;
 
$link = mysql_connect('localhost', $db_user, $db_pass);
if (!$link) {
    die('Could not connect: ' . mysql_error());
}else
{
mysql_select_db($db_name, $link) or die('Could not select database.');
$result = mysql_query("SHOW tables", $link);
while($row = mysql_fetch_row($result))
  {
      print("$row[0]<br>");
  }
}
mysql_close($link);
?>
mysql_connection_test_script.txt · Last modified: 2009/06/04 11:07 by k2patel