Thursday, March 27, 2014

Database connection in PHP

Simple code for mysql database connection

Syntax

<?php
$host = "localhost"; /*Host Name*/
$user = "root";  /*User Name*/
$pass = ""; /*Password*/
$db_name = "realestate";  /*Database Name*/

//database connection
$link = mysql_connect($host, $user, $pass);
$db=mysql_select_db($db_name);

?>

No comments:

Post a Comment