Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (22 sloc) 578 Bytes
title date type published status categories tags
Making a MySQL database connection with PHP
2014-06-07 04:54:08 +0500
post
true
publish
Databases
MySQL
<?php
mysql_connect("db_host","db_user","db_pass");
mysql_select_db("db_name");
?>

Where db_host, db_user, db_pass and db_name is the host, username, password and name for your database respectively.

General practice is to save the code in a separate file in the 'includes' folder and including it on the page where you need it.

<?php include("database.php") ?>
You can’t perform that action at this time.