• Image 1
  • Image 2
  • Image 3
  • Image 4
  • Image 5
  • Image 6
  • Image 7




Friday, August 3, 2012

DISPLAY DATABASE IN PHP


Hi…  welcome to my blog in “We Are Knowledge”… In here you want getting many IT knowledge like as : PHP, MYSQL, VB, COBOL, PASCAK, and other.. We aslo provide many article…

Now.. I want giving you knowledge about PHP and MYSQL, and discuss is “DISPLAY DATABASE IN PHP”..

You know previous ??? If not… Let’s read it !!

For adisplay database in php we are need 3 (three) components. And the components is :

1. DATABASE (in mysql)
2. FILE CONNECTION.PHP
3. FILE DISPLAY.PHP

OK  we are started in sequence..


1. DATABASE

Database is place for saving datas, like as : name, born, address, and other. We can input variable integer, character, or date…
I was disscus about it.. if you do not know you can visit in


2. FILE CONNECTION.PHP

This is file for connection database wirh File display.php.. If you not use it then your coding want error.. I also was discuss about it.. and if you do not know you can too visit in


3. FILE DISPLAY.PHP

You can copy this coding

<html>
<head>
<title></title>
<head>
<body>

<?php
include "koneksi.php";
echo "<table border = 1> <tr> <th> ID MHS </th> <th> NAME MHS </th> <th> SEX MHS </th> <th> DATE MHS </th> <th> ALAMAT </th> </tr>";

$a = "select * from adsanse";
$b = mysql_query($a);
while ($r = mysql_fetch_array($b))
{
$id               = $r [id];
$name       = $r [name];
$sex            = $r [sex];
$born        = $r [born];
$address = $r [address];
echo "<tr> <td align=center> $id </td> <td> $name </td> <td> $sex</td> <td> $born </td> <td> $address </td>
</tr>";
}

?>
</table>
</body>
</html>


If it is you can give name “select.php”.. AND you MUST save as type “PHP”.

NOTE :

IF you using copy + paste please change all quotes (“ “) or (‘ ‘)
name database is = adsanse
name table         is = adsanse
for working you must trun on apache and mysql in "xampp".
write "localhost/insert.html" in your search engine for try the program.
put your saving in folder "htdoc" of xampp.



Ok.. just it 
Thanks for reader…
I hope you understand with this all…
See you later…

No comments:

Post a Comment