refresh ตัวแปร global ยังไงคับ

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

offing
PHP VIP Members
PHP VIP Members
โพสต์: 1527
ลงทะเบียนเมื่อ: 18/08/2014 10:01 am

refresh ตัวแปร global ยังไงคับ

โพสต์ที่ยังไม่ได้อ่าน โดย offing »

refresh ตัวแปร global ยังไงคับ
พอเปลี่ยนขนาดความกว้างเป็น 800 แล้วตั้งค่าในฐานข้อมูลก็เปลี่ยนขนาด width เป็น 800 แต่ตัวแปรจาก global ยังเป็นค่าเก่าก่อนตั้งค่า
ลอง unset แล้วประกาศ global ใหม่ก็ไม่ได้คับ
1.gif
1.gif (8.22 KiB) Viewed 1528 times

โค้ด: เลือกทั้งหมด

function main($id, $mode)
	{       
		global $db, $user, $auth, $template, $cache, $request;
		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
		$this->config = $config;
		$this->request = $request;  
                $this->tpl_name = 'acp_m_mtb_news';
                $submit = (isset($_POST['submit'])) ? true : false;
                $action		= request_var('action', array(''),true);
                $act	=	request_var('maction', '');
                $actionform = '';
                if($action){
                    $actionform = $action[0];
                }else{
                     $actionform = $act;
                }
                switch ($mode)
		{
                   case 'crop_size':
                             
                                $template->assign_vars(array(
                                            'S_WIDTH'    => $config['mtb_crop_width'],
                                            'S_HEIGHT'     => $config['mtb_crop_height'],
                                            'T_ACTION'      => $this->u_action .'&action_m=save',

                                    ));
                                      $action_m = request_var('action_m', '');
                                      switch ($action_m)
                                         {
                                                case 'save':
                                                        $width             = request_var('width','',0);
                                                        $height            = request_var('height','',0);

                                                        $sql = 'UPDATE ' . CONFIG_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
                                                                        'config_value'              =>  $width  ,)) 
                                                        . " WHERE config_name = 'mtb_crop_width'" ;
                                                        $sql_query = $db->sql_query($sql);
                                                        $sql = 'UPDATE ' . CONFIG_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
                                                                        'config_value'              =>  $height  ,)) 
                                                        . " WHERE config_name = 'mtb_crop_height'" ;
                                                        $sql_query = $db->sql_query($sql);
                                                            meta_refresh(2, $this->u_action);
                                                            trigger_error($user->lang['SUCCESS_UPDATED'] . adm_back_link($this->u_action));
                                                    break;
                                        }
                        $this->tpl_name = 'acp_crop_size';
                        $this->page_title = 'ACP_CROP_SIZE';
                        break;       
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 125