+91 88 00 563434 sales@webhostingpeople.net

Connecting to a MySQL Database on Linux Hosting Using PHP

Connecting to a MySQL Database on Linux Hosting Using PHP

There’s following a pattern code for connecting to a MySQL database utilizing PHP.

//Pattern Database Connection Syntax for PHP and MySQL.

//Join To Database
$hostname=”mysql.secureserver.web”;
$username=”your_dbusername”;
$password=”your_dbpassword”;
$dbname=”your_dbusername”;
$usertable=”your_tablename”;
$yourfield = “your_field”;
$connection = mysql_connect($hostname, $username, $password);
mysql_select_db($dbname, $connection);

# Examine If Report Exists

$question = “SELECT * FROM $usertable”;

$outcome = mysql_query($question);

if($outcome)
{
whereas($row = mysql_fetch_array($outcome))
{
$title = $row[“$yourfield”];
echo “Identify: “.$title.”
“;
}
}
?>

About the author

Pretium lorem primis senectus habitasse lectus donec ultricies tortor adipiscing fusce morbi volutpat pellentesque consectetur risus molestie curae malesuada. Dignissim lacus convallis massa mauris enim mattis magnis senectus montes mollis phasellus.