Hi, I currently have an application that provides users with 4 different menus on four different pages with each menu containing 7 options. All menus are stored in database which enables content to be changed by site administrator. However a new menu is added every week. This should be added as the first menu with the next menu then becoming the previous first menu and the next menu becoming the previous second and the next menu becoming the previous third. This is the solution I want to achieve but do not currently have. The current process requires the site admin to update each meal in every menu every week meaning they have to change 28 different options which isn't very efficent when it should be only one. In the database at the moment I just have four unrelated tables and simply let the site admin directly update these. Hope I have explained this well. Any suggestions as to how to put together an efficent solution would be a fantastic help. I can provide my current code if its a help. Thanks
<? include('config.php'); $link=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD)or die("Could not connect: " . mysql_error()); mysql_select_db(""); $result = mysql_query("SELECT * FROM Menu LIMIT 0,5"); while($row = mysql_fetch_array($result)) { $image = $row['Picture']; $title = $row['Title']; $description = $row['Description']; } mysql_close($link); ?> <div class="dishes"> <span> <?echo strip_tags($image, '<img>, <span>'); ?> </span> <h2><?echo strip_tags($title, '<span>');?></h2> <p><?echo strip_tags($description, '<span>');?></p> <div class="clear"></div> </div> Code (markup): I have made some developments with this but now need to print the 5 different results returned from the select statement so that each is displayed within the div class?? Is this possible or is there some better way??
Hi rn, If I'm understanding your post correctly, your issue is related to sort order. Create a timestamp field in your menu table which by default enters the current date/time. You can then revise your sql query <code> $result = mysql_query("SELECT * FROM Menu LIMIT 0,5");</code> to include a sort by clause in descending order on timestamp field.