การเรียกใช้ Field รายละเอียด ในตารางผู้ใช้งาน มีวิธีการเรียกใช้ยังไง

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

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

ภาพประจำตัวสมาชิก
Buck Kittisak
PHP VIP Members
PHP VIP Members
โพสต์: 8816
ลงทะเบียนเมื่อ: 07/05/2024 9:10 am

การเรียกใช้ Field รายละเอียด ในตารางผู้ใช้งาน มีวิธีการเรียกใช้ยังไง

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

ตาราง.png
ตาราง.png (73.39 KiB) Viewed 1591 times
ตอนนี้ผมติดตรงการใช้คำสั่งในส่วนของ Field รายละเอียด ครับว่าต้องมีการ Coding ในลักษณะอย่างไรครับ

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

//ดึงข้อมูลมาแสดงที่ตาราง
$start = (int) $phpbb_container->get('request')->variable('start', 0);
$limit = 10;
$sql_ary = array(
    'SELECT' => '*',
    'FROM' => array(
        'tools_land_building_tax_calculation ' => 'tax',
    ),
    'ORDER_BY' => 'id DESC',
);
$sql2 = $db->sql_build_query('SELECT', $sql_ary);
$result2 = $db->sql_query_limit($sql2, $limit, $start);
$sql_ary['SELECT'] = 'COUNT(tax.id) as num_row';
$sql_num = $db->sql_build_query('SELECT', $sql_ary);
$result_num = $db->sql_query($sql_num);
$count = (int) $db->sql_fetchfield('num_row');

$no = $count - $start;

$template_data = [];
foreach ($data as $category) {
    $template_data[$category[0]] = $category[1];
}

while ($data = $db->sql_fetchrow($result2, $result_num)) {
    $template->assign_block_vars('loop', array(
        'num' => $no, $no--,
        'id' => $data['id'],
        'tlandc_username' => $data['tlandc_username'],
        'tlandc_land_type_id' => isset($template_data[$data['tlandc_land_type_id']]) ? $template_data[$data['tlandc_land_type_id']] : '',
        'tlandc_land_value' => number_format($data['tlandc_land_value']),
        'tlandc_building_value' => number_format($data['tlandc_building_value']),
        'tlandc_tax_rate' => ($data['tlandc_tax_rate']),
        'tlandc_total_tax' => number_format($data['tlandc_total_tax']),
        'tlandc_create_date' => $user->format_date($data['tlandc_create_date']),
        'tlandc_user_ip' => checkip($data['tlandc_user_ip']),
    ));
}



$sql2 = $db->sql_build_query('SELECT', $sql_ary);
$result2 = $db->sql_query_limit($sql2, $limit, $start);
โดยตอนนี้ส่วนข้อมูลอื่นๆมีครบหมดแล้วครับในตารางผู้ใช้งานขาดแค่ส่วนรายละเอียดที่ต้องการทราบลักษณะการทำงานของ Code ครับ
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 47261
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Re: การเรียกใช้ Field รายละเอียด ในตารางผู้ใช้งาน มีวิธีการเรียกใช้ยังไง

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

หมายถึงทำลิงค์เพื่อให้กดเข้าไปดูหน้ารายละเอียดหรือเปล่า

Url.php?id=[recode_id]
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ภาพประจำตัวสมาชิก
Buck Kittisak
PHP VIP Members
PHP VIP Members
โพสต์: 8816
ลงทะเบียนเมื่อ: 07/05/2024 9:10 am

Re: การเรียกใช้ Field รายละเอียด ในตารางผู้ใช้งาน มีวิธีการเรียกใช้ยังไง

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

mindphp เขียน: 03/06/2024 10:17 am หมายถึงทำลิงค์เพื่อให้กดเข้าไปดูหน้ารายละเอียดหรือเปล่า

Url.php?id=[recode_id]
ใช่ครับ อยากทราบขั้นตอนหรือแนวทางการ Coding
ภาพประจำตัวสมาชิก
Buck Kittisak
PHP VIP Members
PHP VIP Members
โพสต์: 8816
ลงทะเบียนเมื่อ: 07/05/2024 9:10 am

Re: การเรียกใช้ Field รายละเอียด ในตารางผู้ใช้งาน มีวิธีการเรียกใช้ยังไง

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

ไฟล์php

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

while ($data = $db->sql_fetchrow($result2, $result_num)) {
    $template->assign_block_vars('loop', array(
        'num' => $no,
        'id' => $data['id'],
        'tlandc_username' => $data['tlandc_username'],
        'tlandc_land_type_id' => isset($template_data[$data['tlandc_land_type_id']]) ? $template_data[$data['tlandc_land_type_id']] : '',
        'tlandc_land_value' => number_format($data['tlandc_land_value']),
        'tlandc_building_value' => number_format($data['tlandc_building_value']),
        'tlandc_tax_rate' => ($data['tlandc_tax_rate']),
        'tlandc_total_tax' => number_format($data['tlandc_total_tax']),
        'tlandc_create_date' => $user->format_date($data['tlandc_create_date']),
        'tlandc_user_ip' => checkip($data['tlandc_user_ip'], true),
        'tax_detail' => append_sid(generate_board_url() . '/tools_land_building_tax_detail.html/show/' . $data['id']),
    ));
}
html รับค่า

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

<tbody>
                <!-- BEGIN loop -->
                <tr class="bg1">
                    <td>
                        <span class=""></span>
                        <font size="1"><a href="">{loop.id} </a>
                        </font>
                    </td>
                    <td>
                        <span class=""></span>
                        <font size="1"><a href="">{loop.tlandc_username} </a>
                        </font>
                    </td>
                    <td>
                        <span class=""></span>
                        <font size="1"><a href="">{loop.tlandc_land_type_id} </a>
                        </font>
                    </td>
                    <td>
                        <span class=""></span>
                        <font size="1"><a href="">{loop.tlandc_tax_rate} </a>
                        </font>
                    </td>
                    <td>
                        <span class=""></span>
                        <font size="1"><a href="">{loop.tlandc_land_value} </a>
                        </font>
                    </td>
                    <td>
                        <span class=""></span>
                        <font size="1"><a href="">{loop.tlandc_building_value} </a>
                        </font>
                    </td>
                    <td>
                        <span class=""></span>
                        <font size="1"><a href="">{loop.tlandc_total_tax} </a>
                        </font>
                    </td>
                    <td>
                        <span class=""></span>
                        <font size="1"><a href="">{loop.tlandc_create_date} </a>
                        </font>
                    </td>
                    <td>
                        <span class=""></span>
                        <font size="1"><a href="">{loop.tlandc_user_ip} </a>
                        </font>
                    </td>
                    <td>
                        <span class=""></span>
                        <font size="1"><a href="{loop.tax_detail}">{L_DESCRIPTION} </a>
                        </font>
                    </td>
                </tr>

                <!-- END loop -->
            </tbody>
ตอนนี้ผมส่งค่า tax_detail ไปยังหน้า html แต่มี Error Not Found ครับพอมีแนวทางแก้ไขอย่างไรบ้างครับ
not 404.png
not 404.png (19.68 KiB) Viewed 1367 times
ภาพประจำตัวสมาชิก
eange08
PHP VIP Members
PHP VIP Members
โพสต์: 23559
ลงทะเบียนเมื่อ: 22/12/2020 10:09 am

Re: การเรียกใช้ Field รายละเอียด ในตารางผู้ใช้งาน มีวิธีการเรียกใช้ยังไง

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

รูปแบบตัวลิงค์ผิดอยู่นะคะ

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

'tax_detail' => append_sid(generate_board_url() . '/tools_land_building_tax_detail.html/show/' . $data['id']),
ลิงค์แบบ phpBB จะไม่ได้ใช้ .html เพื่ออ้างอิงไปหน้าอื่นๆ แต่ต้องอ้างอิงจาก .php เป็นหลัก
จากที่เคยแนะนำไป viewtopic.php?p=373883#p373883
ภาพประจำตัวสมาชิก
Buck Kittisak
PHP VIP Members
PHP VIP Members
โพสต์: 8816
ลงทะเบียนเมื่อ: 07/05/2024 9:10 am

Re: การเรียกใช้ Field รายละเอียด ในตารางผู้ใช้งาน มีวิธีการเรียกใช้ยังไง

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

eange08 เขียน: 04/06/2024 10:58 am รูปแบบตัวลิงค์ผิดอยู่นะคะ

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

'tax_detail' => append_sid(generate_board_url() . '/tools_land_building_tax_detail.html/show/' . $data['id']),
ลิงค์แบบ phpBB จะไม่ได้ใช้ .html เพื่ออ้างอิงไปหน้าอื่นๆ แต่ต้องอ้างอิงจาก .php เป็นหลัก
จากที่เคยแนะนำไป viewtopic.php?p=373883#p373883
กำหนดค่า

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

$template->assign_vars(
    array('LAND_BUIDING_TAX_DETAIL' => append_sid("tools_land_building_tax_calculation.php?page=detail_land_building_tax_calculation")));
ส่วนของการส่งค่า

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

// ทำการตรวจสอบว่าต้องการแสดงหน้าเว็บไซต์ใด
$page = $request->variable('page', '', true); // รับค่า page มาจาก URL

if ($page == 'table_land_building_tax_calculation') {
    $show_page = 'tools_land_building_tax_table.html';
} elseif ($page == 'detail_land_building_tax_calculation') {
    $show_page = 'tools_land_building_tax_detail.html';
} else {
    $show_page = 'tools_land_building_tax_view.html';
}

// ตั้งค่าไฟล์ที่ต้องการส่งไปยังเทมเพลต
$template->set_filenames(
    array(
        'body' => $show_page
    )
);
รูปแบบการลิ้งค์

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

'tax_detail' => append_sid(generate_board_url() . '/LAND_BUIDING_TAX_DETAIL/show/' . $data['id']),
อยากทราบว่าต้องปรับปรุงส่วนไหนครับตอนนี้ยัง Error 404 ครับ
ภาพประจำตัวสมาชิก
eange08
PHP VIP Members
PHP VIP Members
โพสต์: 23559
ลงทะเบียนเมื่อ: 22/12/2020 10:09 am

Re: การเรียกใช้ Field รายละเอียด ในตารางผู้ใช้งาน มีวิธีการเรียกใช้ยังไง

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

LAND_BUIDING_TAX_DETAIL มาจากไหนค่ะ ??

'tax_detail' => append_sid(generate_board_url() . '/LAND_BUIDING_TAX_DETAIL/show/' . $data['id']),

ไม่ค่อยเข้าใจ ขอ code ส่วนที่เป็นลิงค์และส่งไปหน้า html
ภาพประจำตัวสมาชิก
Buck Kittisak
PHP VIP Members
PHP VIP Members
โพสต์: 8816
ลงทะเบียนเมื่อ: 07/05/2024 9:10 am

Re: การเรียกใช้ Field รายละเอียด ในตารางผู้ใช้งาน มีวิธีการเรียกใช้ยังไง

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

eange08 เขียน: 04/06/2024 11:40 am LAND_BUIDING_TAX_DETAIL มาจากไหนค่ะ ??

'tax_detail' => append_sid(generate_board_url() . '/LAND_BUIDING_TAX_DETAIL/show/' . $data['id']),

ไม่ค่อยเข้าใจ ขอ code ส่วนที่เป็นลิงค์และส่งไปหน้า html
LAND_BUIDING_TAX_DETAIL มาจากส่วนนี้บรรทัดที่ 2

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

$template->assign_vars(
    array(
        'LAND_BUILDING_TAX_TABLE' => append_sid("tools_land_building_tax_calculation.php?page=table_land_building_tax_calculation"),
        'LAND_BUIDING_TAX_DETAIL' => append_sid("tools_land_building_tax_calculation.php?page=detail_land_building_tax_calculation"),
        'LAND_BUIDING_TAX_VIEW' => append_sid("tools_land_building_tax_calculation.php?page=view_land_building_tax_calculation"),
        'LAND_BUIDING_TAX_REULT' => append_sid("tools_land_building_tax_calculation.php?page=view_land_building_tax_calculation"),
        'LINK_ARTICLE_1' => 'https://www.mindphp.com/forums/viewtopic.php?t=105580',
        'LINK_ARTICLE_2' => 'https://www.mindphp.com/forums/viewtopic.php?t=105581',
        'LINK_ARTICLE_3' => 'https://www.mindphp.com/forums/viewtopic.php?t=105564',
        'LINK_ARTICLE_4' => 'https://www.mindphp.com/forums/viewtopic.php?t=105649',
        'LINK_ARTICLE_5' => 'https://www.mindphp.com/forums/viewtopic.php?t=105704',
        'LINK_ARTICLE_6' => 'https://www.mindphp.com/forums/viewtopic.php?t=105647',
        'LINK_TAG_1' => 'https://www.mindphp.com/%E0%B8%9A%E0%B8%97%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1/194-e-commerce/%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1%E0%B8%A3%E0%B8%B9%E0%B9%89%E0%B8%98%E0%B8%B8%E0%B8%A3%E0%B8%81%E0%B8%B4%E0%B8%88/9886-vat-report.html',
        'LINK_TAG_2' => 'https://www.mindphp.com/%E0%B8%9A%E0%B8%97%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1/194-e-commerce/%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1%E0%B8%A3%E0%B8%B9%E0%B9%89%E0%B8%98%E0%B8%B8%E0%B8%A3%E0%B8%81%E0%B8%B4%E0%B8%88/4230-e-tax-invoice.html',
        'LINK_TAG_3' => 'https://www.mindphp.com/%E0%B8%9A%E0%B8%97%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1/31-%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1%E0%B8%A3%E0%B8%B9%E0%B9%89%E0%B8%97%E0%B8%B1%E0%B9%88%E0%B8%A7%E0%B9%84%E0%B8%9B/9642-calculation-of-land-price-per-square-wah.html',
        'LINK_TAG_4' => 'https://www.mindphp.com/%E0%B8%9A%E0%B8%97%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1/94-accounting-software/8195-who-is-obliged-to-pay-personal-income-tax.html',
        'LINK_TAG_5' => 'https://www.mindphp.com/%E0%B8%9A%E0%B8%97%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1/31-%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1%E0%B8%A3%E0%B8%B9%E0%B9%89%E0%B8%97%E0%B8%B1%E0%B9%88%E0%B8%A7%E0%B9%84%E0%B8%9B/4625-itax-pro.html',
        'LINK_SEE_MORE' => 'https://www.mindphp.com/forums/viewtopic.php?t=105580',
        'LINK_REPORT' => 'https://www.mindphp.com/forums/viewtopic.php?t=105599',
        'LINK_SHARE' => 'https://www.facebook.com/sharer/sharer.php?',
        'LINK_TWITTER' => 'https://twitter.com/intent/tweet?original_referer=',
    )
);
ส่วนที่ส่งค่าไปยัง html

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

// ทำการตรวจสอบว่าต้องการแสดงหน้าเว็บไซต์ใด
$page = $request->variable('page', '', true); // รับค่า page มาจาก URL

if ($page == 'table_land_building_tax_calculation') {
    $show_page = 'tools_land_building_tax_table.html';
} elseif ($page == 'detail_land_building_tax_calculation') {
    $show_page = 'tools_land_building_tax_detail.html';
} else {
    $show_page = 'tools_land_building_tax_view.html';
}

// ตั้งค่าไฟล์ที่ต้องการส่งไปยังเทมเพลต
$template->set_filenames(
    array(
        'body' => $show_page,
    )
);
ภาพประจำตัวสมาชิก
eange08
PHP VIP Members
PHP VIP Members
โพสต์: 23559
ลงทะเบียนเมื่อ: 22/12/2020 10:09 am

Re: การเรียกใช้ Field รายละเอียด ในตารางผู้ใช้งาน มีวิธีการเรียกใช้ยังไง

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

eange08 เขียน: 04/06/2024 11:40 am LAND_BUIDING_TAX_DETAIL มาจากไหนค่ะ ??

'tax_detail' => append_sid(generate_board_url() . '/LAND_BUIDING_TAX_DETAIL/show/' . $data['id']),

ไม่ค่อยเข้าใจ ขอ code ส่วนที่เป็นลิงค์และส่งไปหน้า html
ขอแค่ส่วนลิงค์ที่ใช้ตรงที่ รายละเอียด ทั้งใน php กับ html เท่านั้นนะคะ
และส่วนที่ส่งค่าไปยัง html เป็นส่วนแสดงหน้าจอของ html ไม่ใช่ที่ส่งค่า
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

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

สมาชิกกำลังดูบอร์ดนี้: Google Adsense [Bot] และบุคลทั่วไป 10