Student Of Fortune

Database Connection Using PHP And MySQL

Share on :
Making dynamic web sites usually use a database. PHP supports many databases such as MySQL and Oracle.
In this article will show how a database connection with MySQL from PHP.

In general, the step commands are as follows (assuming the Web server at address 192.168.1.2, using a database server with the address 192.168.1.1, user ajonk , cobapsw password, database prothelon, tabel1 table):
 
<?
mysql_connect ('192 .168.1.1 ',' ajonk '. "cobapsw');
$ data_buffer = mysql_query ("select * from prothelon.tabel1");
while ($ data = mysql_fetch_row ($ data_buffer)) {
echo ("This is the data $ data [0], $ data [1]
");
 }
mysql_close ();
?>
 

Please note that before it can be accessed by PHP, then the user needs to be made to the specimen with the MySQL command as follows:

GRANT ALL on prothelon .* to ajonk@ '192 .168.1.2 'IDENTIFIED BY' cobapsw ';
 

0 comments on Database Connection Using PHP And MySQL :

Post a Comment and Don't Spam!

Dont Spam please

 
Recommended Post Slide Out For Blogger

Recent Comments

My Rank