View Single Post
  #12  
Old 01-02-2009, 05:45 AM
Dax IX Dax IX is offline
 
Join Date: Jul 2005
Posts: 153
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'>&nbsp;</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!
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01113 seconds
  • Memory Usage 1,802KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete