ขอสอบถาวิธีแก้ปัญหา ทำไมเพิ่มข้อมูลคำพจนานุกรมไป , ใน ฐานข้อมูล , ดูเหมือนหมวดหมู่จะ Insert ไม่เข้าครับ

กฎการใช้บอร์ด
คำถามหมวดนี้ ควรระบุ รายละเอียดของ Server OS, เวอร์ชั่น ของ PHP, CMS ที่ท่านใช้
รวมถึง Hosting หรือ Control Panel Hosting

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: ขอสอบถาวิธีแก้ปัญหา ทำไมเพิ่มข้อมูลคำพจนานุกรมไป , ใน ฐานข้อมูล , ดูเหมือนหมวดหมู่จะ Insert ไม่เข้าครับ

Re: ขอสอบถาวิธีแก้ปัญหา ทำไมเพิ่มข้อมูลคำพจนานุกรมไป , ใน ฐานข้อมูล , ดูเหมือนหมวดหมู่จะ Insert ไม่เข้าครับ

โดย mindphp » 14/11/2020 11:28 am

เช็คตั้งแต่ การสร้างฟอร์ม
การรับค่า
$ecatt = request_var('ecatt', 0);

debug ดูค่าออกมาตรงตามที่เลือกหรือเปล่า

ขอสอบถาวิธีแก้ปัญหา ทำไมเพิ่มข้อมูลคำพจนานุกรมไป , ใน ฐานข้อมูล , ดูเหมือนหมวดหมู่จะ Insert ไม่เข้าครับ

โดย makup » 13/11/2020 11:30 am

พอจะทำการเพิ่มข้อมูล คำพจนานุกรมลงไปในตาราง ฐานข้อมูลแล้ว , เราได้ทำการเลือกหมวดหมู่ ERP

report_1.png

กลับไปดูที่ตาราง ปรากฎว่า Fields ecat นั้น ยังเป็นหมายเลข 0 , ไม่ทราบว่า พอมีวิธีแก้ปัญหานี้ไหมครับ ทำไมเลือกหมวดหมู่ใน Form Insert ไปแล้ว , ถึงยังเป็นเลข 0 อยู่

report_2.png
report_2.png (25.19 KiB) Viewed 864 times

ตัวอย่าง Code Controller/dictionary.php :

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

 case 'addform':
                $search = request_var('search_insert', '', true);
                $ecatt = request_var('ecatt', 0);
                $module_id = request_var('module_id', 0);
                $textethai = utf8_normalize_nfc(request_var('', $detailth, true));
                $uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage
                $allow_bbcode = $allow_urls = $allow_smilies = true;
                generate_text_for_storage($textethai, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
                $sql = 'INSERT INTO ' . MOD_DICTIONARY_TABLE . ' ' . $db->sql_build_array('INSERT', array(
                            'esearch' => (string) $search,
                            'eentry' => (string) $nameeg,
                            'tentry' => (string) $nameth,
                            'ecat' => (int) $ecatt,
                            'ethai' => (string) $textethai,
                            'bbcode_bitfield' => (string) $bitfield,
                            'bbcode_uid' => (string) $uid,
                            'user_id_add' => (int) $user->data['user_id'],
                            'approved' => 0,
                           'add_time' => time(),
                            'programe_id' => (int) $module_id,
                            'tags' => (string) $tags
                ));
                $sql_query = $db->sql_query($sql);
                $modid = $db->sql_nextid();

                if (!empty($marked)) {
                    for ($i = 0, $loop = count($marked); $i < $loop; $i++) {
                        $sql = 'INSERT INTO ' . MOD_DICTIONARY_TOPICE_TABLE . ' ' . $db->sql_build_array('INSERT', array(
                                    'dictionary_id' => (int) $modid,
                                    'topics_id' => (int) $marked[$i],
//                            'forum_id'         =>   (int)$forumid[$i],
                                    'user_id_add' => (int) $user->data['user_id']
                        ));
                        $sql_query = $db->sql_query($sql);
                    }
                }
                $sql = 'INSERT INTO ' . MOD_DICTIONARY_TOPICE_TABLE . ' ' . $db->sql_build_array('INSERT', array(
                            'dictionary_id' => (int) $modid,
                            'topics_id' => (int) 0,
                            'forum_id' => (int) 0,
                            'user_id_add' => (string) $user->data['user_id']
                ));
                $sql_query = $db->sql_query($sql);
                meta_refresh(3, append_sid("{$phpbb_root_path}$redirect_url"));
                //trigger_error('<a href="">' . $user->lang['RETURN_FORUM_DIC'] . '</a>', E_USER_WARNING);
                redirect(append_sid("{$phpbb_root_path}$redirect_url"));
                break;

ข้างบน