PHP and MySQL

PHP is most popular server-side web programming in the planet.

According to NetCraft’s surveys, there are more than 20 million domains hosted on web hosting services with PHP support.

The ‘true love’ of PHP is MySQL. MySQL is database engine used by PHP to store many of information in our dynamic pages.

But, how’s the way to connecting this couple? Here we go:

<?php
$host = "localhost"; //default name for host name. Change is may not necessary
$user = "dbuser"; //your MySQL database username
$pass = "dbpass"; //your MySQL database password
$db = "dbname"; //your MySQL database name$conn = mysql_connect("$host", "$user", "$pass") or die ("Unable to connect to database.");
mysql_select_db("$db", $conn);
?>

After get it connected, then you can operate it as much as you want.

I’ll teach you in advance on next posts.

4 Responses to PHP and MySQL

  1. nobon says:

    bro! bisa jelasin cara installation mysql base windows, pemakaiannya bukan untuk server (buat latihan aja).

    thank’s

  2. frozenade says:

    kenapa ga pake XAMPP aja? lebih gampang kok buat belajar, malah sekalian ada interpreter buat PHP, jadi bisa sekalian belajar PHP juga.

  3. nobon says:

    thank’ s infonya, ternyata XAMPP udah komplit

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: