Mysql Tutorial – connect to mysql database
Hello Friends,
If you are a learner (new) in PHP / Mysql and dont know how to make connection with mysql database from php file than Here is the easiest and error-free way to make connection with mysql database.
///*** This file will help you to connect with MYSQL using PHP - Rakshit Patel **////
$dbhostname = 'localhost'; // host name
$dbusername = 'root'; // mysql database username
$dbpassword = ''; // mysql database password$connection = mysql_connect($dbhostname, $dbusername, $dbpassword)
or die ('!! can not connect to mysql !!'); // connection with mysql
?>
You just have to change the value as per yours. e.g. Replace ‘localhost’ with your server/host name , Replace ‘root’ with mysql database username , Replace ” with mysql database password.
Note : Please save this file as mysql-connection.php . This will helpful while doing other interaction with database like.. Create database , Drop Database , Select Database , Create table , Select data , Insert data , Update data , Delete data..
Cheers !!
No related posts.
| Print article | This entry was posted by Rakshit Patel on March 8, 2009 at 5:30 am, and is filed under Mysql, PHP, Programming. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |

I am
I am Shail Patel studing in MCA and working as PHP developer(Part time) in ahmedabad. I was looking forward to share my internet ideas to people of this beautiful world. I found this site as an ideal one to do this. Now i am author of this site and i hope my articles will be helpful to you guys.