PHP Interview Questions and Answers

 

How can we connect to a MySQL database from a PHP script?

To be able to connect to a MySQL database, we must use mysql_connect() function as follows:
?
1
2
3
4
$database = mysql_connect("HOST", "USER_NAME", "PASSWORD");
mysql_select_db("DATABASE_NAME",$database);
?>

Posted by:Richards