Wednesday, July 2, 2014

Connect to mysql database in php

$mysql_host = "localhost";
$mysql_user = "root";
$mysql_pass = "";
$mysql_db = "courses";


if(mysql_connect($mysql_host, $mysql_user, $mysql_pass)  && mysql_select_db($mysql_db)){
     echo "successfully connected to database";
}else{
    echo "error connecting to database";
}

No comments:

Post a Comment