I using 3 tables to store booking information: eventinfo, customer and testbook.
My Coding:
<?php
include('config.php');
$per_page = 9;
if($_GET)
{
$page=$_GET['page'];
}
//get table contents
$start = ($page-1)*$per_page;
$sql = "SELECT bookingID,eventinfo.eventTitle,boothAlias,testbook.bstatus,date'"
."testbook.username, customer.companyName, customer.contactName"
."from eventinfo, testbook, customer where testbook.username=customer.username"
." and testbook.eventID=eventinfo.eventID order by date limit $start,$per_page";
$rsd = mysql_query($sql);
?>
<table width="800px">
<?php
//Print the contents
while($row = mysql_fetch_array($rsd))
{
$id=$row['companyName'];
$contactName=$row['contactName'];
$eventTitle=$row['eventTitle'];
//$phone=$row['phone'];
$date=$row['date'];
$status=$row['bstatus'];
$booth=$row['boothAlias']
?>
<tr><td style="color:#B2b2b2; padding-left:4px"><?php echo $id; ?></td><td><?php echo $contactName; ?></td>
<td><?php echo $eventTitle; ?></td><td><?php echo $booth; ?></td><td><?php echo $date; ?></td><td><select name='status' id='status'>
<option value='-1'>--Select--</option>
<option value='0'>Approve</option>
<option value='1'>Reject</option>
<option value='2'>Pending</option>
</select></td>
</tr>
<?php
} //while
?>
</table>
And it return this:

I try to print out the record in the following pattern:

Anyone can help me?
Assuming you have all of your records ordered by
idfirst, followed bycontactNameand theneventTitle, a simple conditional can check to see if the current records values match that of the previously displayed record, and if they do, omit them. I’ve use ternary operators in this code just for the sake of compactness.