how to connect to database in php 5.4 ?

Recommended Answers

All 3 Replies

    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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.