Case Study

Wednesday, November 9, 2011

N4M Davao

Visit http://www.n4mdavao.ph

The site is locally made for local people in Davao City.

Thursday, June 16, 2011

Basic PHP: Connecting to MYSQL Database

Here is a simple code that will connect us from our MYSQL Database.
First and foremost. We need to create the database name first.
I will not explain the creation of database using MYSQL here since It will
consume more time explaining.

One we have the database ready.

We need a simple PHP script to make a connection:
Assuming we have our local webserver running.

Heres the simple code:

Save this as. Connect.php


$db_host = "localhost";
$db_user = "root";
$db_pass = "xxx"; --- xxx represents your password given to your database.
$db_name = "xxx"; ---- xxx represents the name of your database created.

mysql_connect($db_host,$db_user,$db_pass,$db_name);



That's it. The Code is fairly simple enough to understand.
Once you are connected to the database. You may now be able to create
PHP scripts to ADD, DELETE, VIEW , EDIT datas.

Thanks a lot