how to connect to database in php 5.4 ?

<?php 
    mysql_connect("localhost","root","") or die("Couldnt Connect to Server");
    mysql_select_db("Name of Your Database") or die("Coudnt find Database");

?>

(However, note that the mysql_* functions will be deprecated in the future, so it is recommended you use another extension for making a MySQL connection, for example PDO or MySQLi.)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.