flemingmike Posted October 5, 2010 Share Posted October 5, 2010 hello, i have the following, which is sorting by id number with a horizontal line between. im trying to make it so that it is sorted by supplier with lines between each letter. <?phpif ($PreviousID!=0 && $ManID != $PreviousID) {?> <hr /> <?PHP } $PreviousID = $ManID; include 'config.php';include 'javascript.php';@mysql_select_db ("citycore", $conn) OR DIE (mysql_error());$sql = "SELECT * FROM supplier ORDER BY supplier";$result = @mysql_query($sql, $conn) or die(mysql_error());//$row2 = mysql_query($sql, $conn);$PreviousID=0;while ($row = mysql_fetch_array($result)) { $ManID = $row['id']; $id=$row['id']; $supplier=$row['supplier']; $address=$row['address']; $city=$row['city']; $province=$row['province']; $postal=$row['postal']; $phone2=$row['phone2']; $phone=$row['phone']; $fax=$row['fax']; $email=$row['email']; ?> <div align="center"> <table border="1" width="95%" style="border-collapse: collapse"> <tr> <td><?php echo $row['supplier'];?></td> <td><a href="http://mapof.it/<?php echo($address .' ' .$city .',' .' ' .$province .' ' .$postal); ?>" target="_blank"><?php echo($address .' ' .$city .',' .' ' .$province .' ' .$postal); ?></a></td> </tr> </table> </div><?PHP } ?> Link to comment https://forums.phpfreaks.com/topic/215222-sorting-by-letter/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.