Connect To MySQL Database : MySQL Connection : MySQL Database PHP Source Code


PHP Source Code » MySQL Database » MySQL Connection »

 

Connect To MySQL Database





<?php
//
$hostname="mysql153.secureserver.net";
$username="navioo";
$password="password";
$dbname="navioo";
$usertable="Employee";
$yourfield = "FirstName";

mysql_connect($hostname,$username, $passwordOR DIE ("Unable to connect to database! Please try again later.");
mysql_select_db($dbname);

$query = "SELECT * FROM $usertable";
$result = mysql_query($query);
if($result) {
    while($row = mysql_fetch_array($result)){
        $name = $row["$yourfield"];
        echo "Name: ".$name;
    }
}
?>
           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo MySQL Database
» MySQL Connection