Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-13-2009, 09:19 PM
vietfancy's Avatar
vietfancy vietfancy is offline
 
Join Date: Feb 2005
Posts: 278
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How do I fix this problem?

This code below seems to work just fine except for when edit and update it just go back to 1 page.

ex: when I view do=sat after edit and update a class ... it redirect back to do=fri. How do I keep it stay in do=sat?

I know the code tell it to go back to do=fri is:
PHP Code:
print_cp_message('Class has been updated''schedule.php?do=' iif($type==1,'fri')); 
but how do I fix it?

Thanks.

here is the code.

PHP Code:
if($_REQUEST['do'] == 'fri'){
    
print_form_header('schedule''delete'falsetrue'delete''90%'''true'post'0);
    
print_table_header("Friday Classes",6);

    
$items $db->query_read("
            SELECT *
            FROM " 
TABLE_PREFIX "table
            WHERE day = 'friday' AND live = '1'
            ORDER BY time
    "
);    
    
$i    1;
    if(
$db->num_rows($items))
    while(
$item $db->fetch_array($items))
    {
        if(
$i%2==0$class 'alt2'; else $class 'alt1';
        echo 
'<tr class="' $class '">
            <td align="center" class="smallfont">'
htmlspecialchars($item['class']) .' <a href="schedule.php?do=edit&scheduleid=' $item['id'] . '&type=1" title="Edit"><img title="Edit Class" alt="Edit Class" src="../images/misc/userfield_edit.gif" border="0" hspace="6"></a></td>
        </tr>'
;    
        
$i++;
    }
    else echo 
'<tr class="alt1"><td align="center" colspan="6">No Class Found!</td></tr>';
    
$db->free_result($items);
    
print_submit_row('Delete" onclick="return confirm(\'Are you sure you want to delete?\')''Reset'6''''false); 
    
print_cp_footer();
}
//Sat
if($_REQUEST['do'] == 'sat'){
    
print_form_header('schedule''delete'falsetrue'delete''90%'''true'post'0);
    
print_table_header("Saturday Classes",6);

    
$items $db->query_read("
            SELECT *
            FROM " 
TABLE_PREFIX "table
            WHERE day = 'saturday' AND live = '1'
            ORDER BY time
    "
);    
    
$i    1;
    if(
$db->num_rows($items))
    while(
$item $db->fetch_array($items))
    {
        if(
$i%2==0$class 'alt2'; else $class 'alt1';
        echo 
'<tr class="' $class '">
            <td align="center" class="smallfont">'
htmlspecialchars($item['class']) .' <a href="ese_schedule.php?do=edit&scheduleid=' $item['id'] . '&type=1" title="Edit"><img title="Edit Class" alt="Edit Class" src="edit.gif" border="0" hspace="6"></a></td>
        </tr>'
;    
        
$i++;
    }
    else echo 
'<tr class="alt1"><td align="center" colspan="6">No Class Found!</td></tr>';
    
$db->free_result($items);
    
print_submit_row('Delete" onclick="return confirm(\'Are you sure you want to delete?\')''Reset'6''''false); 
    
print_cp_footer();
}

if(
$_REQUEST['do']=='edit'){
    
$scheduleid $vbulletin->input->clean_gpc('r','scheduleid',TYPE_INT);
    
$type $vbulletin->input->clean_gpc('r','type',TYPE_INT);
    
$item $db->query_first("
            SELECT *
            FROM " 
TABLE_PREFIX "table
            WHERE id = 
$scheduleid
    "
);        
    
print_form_header('schedule''update');
    
construct_hidden_code('scheduleid'$scheduleid);
    
construct_hidden_code('type'$type);
    
print_hidden_fields();        
    
print_table_header('Editing Class');
    
print_input_row('Class:''class'$item['class']);
    
print_submit_row('Save');
    
print_cp_footer();        
}
if(
$_REQUEST['do']=='update'){
    
$scheduleid $vbulletin->input->clean_gpc('p','scheduleid',TYPE_INT);
    
$class $vbulletin->input->clean_gpc('p','class',TYPE_STR);
    
$type $vbulletin->input->clean_gpc('p','type',TYPE_INT);
    
$extra "";
    
$item $db->query_write("
            UPDATE " 
TABLE_PREFIX "table
            SET class = '" 
$db->escape_string($class) . "'$extra
            WHERE id = 
$scheduleid
    "
);            
    
print_cp_message('Class has been updated''schedule.php?do=' iif($type==1,'fri'));

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:21 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03810 seconds
  • Memory Usage 2,217KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)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
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete