I'll study it a little more, but this seems to give me EXACTLY what I'm looking for:
PHP Code:
$planner_rows = 3;
$planner_columns = 7;
$meals = array("Breakfast","Lunch","Dinner");
$days_of_week = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
if($vbulletin->userinfo['userid']){
$planners = $vbulletin->db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "planners
WHERE memberid = " . $vbulletin->userinfo['userid'] . "
ORDER BY id DESC LIMIT 1
");
$planners_array = array();
$planners_array[] = $vbulletin->db->fetch_array($planners);
$menuids = $planners_array[0][menuids];
$menus = $vbulletin->db->query_read("
SELECT id, shortdescription
FROM " . TABLE_PREFIX . "menus
WHERE id IN ($menuids)
");
}
$menus_temp = array();
while ($menu = $vbulletin->db->fetch_array($menus))
{
$menus_temp[$menu[id]] = $menu;
}
$menus_array = array();
$id_order = explode(',', $menuids);
foreach ($id_order AS $id)
{
$menus_array[] = $menus_temp[$id];
}
echo "<table style='border:none;width:1070px;'>
<tr>
<td style='border:none;width:70px'> </td>";
for($n = 0; $n < $planner_columns; $n++) {
echo " <td style='color:#FF0000;width:140px;border:none;padding:5px;'><strong>" . $days_of_week[$n] . "</strong></td>";
}
echo " </tr>";
for($i = 0; $i < $planner_rows; $i++) {
echo " <tr>
<td style='color:#FF0000;width:70;border:none;text-align:right;padding-right:5px;'><strong>" . $meals[$i] . "</strong></td>";
$list_menu = $i;
for($ii = 0; $ii < $planner_columns; $ii++) {
echo "<td style='width:140;border:1px solid black;padding:5px;'>" . ($list_menu +1) . " " . $menus_array[$list_menu]['shortdescription'];
$list_menu += $planner_rows;
echo "</td>";
}
echo "</tr>";
}
echo "</table>";
Thank you so much for your help!
I'm not sure exactly how yet, but originally it was listing the menu descriptions in the order that they were entered into the database instead of by the order that they're listed in $menuids. But with your help I was able to get them to display exactly how I want them.
Thank you again!
--------------- Added [DATE]1230882971[/DATE] at [TIME]1230882971[/TIME] ---------------
Unless you have something that you really want to point out with this script the way I have it, this can be marked as SOLVED.
Thanks again!