Welcome to DevelNet, a code gallery for creating, saving and sharing all kinds of code snippets.

PHP — Connect to mysql

Posted On: Wednesday, January 14, 2015 at 7:32 PM

How to connect to mysql

// set your MySQL login details
$db_host = "localhost";
$db_user = "username";
$db_pass = "password";
$db_name = "databasename";

$connection = mysql_connect($db_host,$db_user,$db_pass);
if (!(mysql_select_db($db_name,$connection))) {
echo "Could not connect to the database";

Snip Comments

says Thursday, October 26, 2017 at 10:42 AM

Visit our website:- 



Joined on
Contributed 6 Snips

Get Social and Share