Connecting MySQL from PHP

Gladly Our project is going well at a good pace…

Now I had to connect to the mysql database from my php pages…
I suddenly learnt it from new “Head First PHP & MySQL” book that I bought last week.
The connection string is…

$dbc = mysqli_connect(‘hostname’,’username’,’password’,’DBname’);

The php functions to talk tp the database are as follows:


Now i need to move through the data in the table or the resultset obtained… just like the java code ( while ( )…
The php code is…

while( $row = mysqli_fetch_array($result) )
Now it works great for me 🙂

Leave a Reply

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

You are commenting using your 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