Database | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Database

How to connect with database...?

22nd Jul 2016, 2:41 PM
Al Shahrior Hasan Sagor
Al Shahrior Hasan Sagor - avatar
2 Answers
0
If connection with mysql is required then: <?php $dbhost = 'localhost:3036'; $dbuser = 'root'; $dbpass = 'rootpassword'; mysql_connect($dbhost, $dbuser, $dbpass); mysql_close($conn); ?>
23rd Jul 2016, 4:04 AM
PUNEET SINGH
PUNEET SINGH - avatar
0
pls stop use mysql_connect, this function is deprecated. .. use PDO like $db =new PDO(yourdriver:dbname=yourdbname;host=yourhost, user, pass) look php.net PDO construct for more information
5th Aug 2016, 10:06 AM
francis