Posted by Arjun on Thursday 31st May 2012

Displaying MySQL Table records in unordered list format Using PHP?

Table records unordered list

This post is about data retrieving from MySQL database table using PHP. The bellow PHP script will give you Unordered list format output.

Before doing any operations on database server, you must open connection to the server if your not filmier with database connection click here

$db = mysql_connect('localhost','root','');
$query = mysql_query("SELECT * FROM test_table");
while($row = mysql_fetch_object($query) ) {
  $data[] = $row;
  <?php foreach($data as $items) {  ?>
  <li><a href="<?php  echo $items->item_url; ?>" title="<?php echo  $items->item_name; ?>"><?php echo  $items->item_name; ?></a> </li>
  <?php } ?>

Using PHP you can fetch data from database in several ways, here is another post which covered another method, visit it for more info PHP Function to get data from MySQL Database?