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
Help with putting a solution together
Moderator: General Moderators
Re: Help with putting a solution together
You can achieve your first requirement by just updating the menu order in the database.
And you can display the menu with the defined order.
If you can provide your current code, then it would be more easy to understand it.
And you can display the menu with the defined order.
If you can provide your current code, then it would be more easy to understand it.
Re: Help with putting a solution together
This is what I have so far 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??<?
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>
Re: Help with putting a solution together
I could really do with some help if anybody has a few minutes to spare that would be great
Thanks
Thanks
- novice4eva
- Forum Contributor
- Posts: 327
- Joined: Thu Mar 29, 2007 3:48 am
- Location: Nepal
Re: Help with putting a solution together
I don't know if this is what you wanted!! But here it goes:
I didn't understand well but it sounds like you want the latest addition of the menu item at the beginning. If this is the case then i recommend adding a new new like date and time to know which one is the latest and you can do a simple order by thing, or if you have menu code field in your "menu" table which is number and primary key too with auto increment feature then the highest menu code will be the latest one. Though i am serious when i say i really don' t know if any of this is what you were looking for!!!
Code: Select all
<?
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");
?>
<div class="dishes">
<?php
while($row = mysql_fetch_array($result))
{
$image = $row['Picture'];
$title = $row['Title'];
$description = $row['Description'];
?>
<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>
<?php
}
?>
</div>
<?php
mysql_close($link);
?>