ok ive got this code to print out the information from the database onto the page. <?php $query = "SELECT * from Storage"; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { echo "<div id=\"test\" style=\"width: 160px; float: left; margin-top: 30px; margin-left: 10px; display: inline; border: 1px solid black;\"><div id=\"image\" \"style=\"\">" ."<img src=\"images/storage/" .$row["item_code"] .".jpg\"></div>" ."<div id=\"text\" style=\"width: 160px; padding-left: 10px; font-family: verdana; font-size: 10pt; \">" .$row["item_desc"] ."<br>" ."£".$row["item_price"] ."</div></div>"; } ?> Code (markup): was wondering does anyone know how to change the order on how it prints out the information for example if i add in 3 stock items in the database called 1,2,3 then it will print them out 3,2,1, can anyone give me a hint on how to change this around.
$query = "SELECT * from Storage"; $result = mysql_query($query); for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) { if (!mysql_data_seek($result, $i)) { echo "Cannot seek to row $i: " . mysql_error() . "\n"; continue; }//end if $row = mysql_fetch_assoc($result); echo "<div id=\"test\" style=\"width: 160px; float: left; margin-top: 30px; margin-left: 10px; display: inline; border: 1px solid black;\"><div id=\"image\" \"style=\"\">" ."<img src=\"images/storage/" .$row["item_code"] .".jpg\"></div>" ."<div id=\"text\" style=\"width: 160px; padding-left: 10px; font-family: verdana; font-size: 10pt; \">" .$row["item_desc"] ."<br>" ."£".$row["item_price"] ."</div></div>"; }//end for loop PHP: