mysql database connection using php

Aug 2 2015 12:25 PM
plz help me.i am developing a webpage .i want to connect mysql database by using php .i did connection code in php. but i did't get the connection.
here i am attach what i did. if any one knows how to connect mysql database plz send the answer. 
 
 
 
<?php
$dbhost = "localhost";
$username = "root";
$password = "";
$dbname = "test";
$conn = mysql_connect($dbhost,$username,$password) or die ("db error");
$select_db = mysql_select_db($dbname) or die ("cloud not select db");
$db=mysql_select_db("test",$conn);
$query=mysql_query("select * from local_bus",$db);
?>
 

Answers (3)