สอบถามการแปลง timestamp บน database

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

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

ภาพประจำตัวสมาชิก
Thanapoom1514
PHP VIP Members
PHP VIP Members
โพสต์: 4329
ลงทะเบียนเมื่อ: 04/07/2022 9:46 am

สอบถามการแปลง timestamp บน database

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

สอบถามแปลง timestamp บน database ต้องแปลงยังไงครับ และในหน้าแสดงผลมันขึ้น array ของช่องเวลาการอัปเดตต้องทำยังไงครับ
หน้าจอแสดงผล
print_r.png
print_r.png (13.02 KiB) Viewed 404 times
หน้าจอแสดงผล.png
หน้าจอแสดงผล.png (22.72 KiB) Viewed 404 times
php

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

 $start = request_var('start', 0);
    $limit = 10;
    $sql_array = array(
        'SELECT'    => '*',
        'FROM'     => array(
            'tools_plant_type' => 't',
        ),
        'ORDER_BY' => 'id DESC',
    '');
    
    $sql = $db->sql_build_query('SELECT', $sql_array);
    $result = $db->sql_query_limit($sql, $limit, $start);
    $row = $db->sql_fetchrow($result);
    print_r( $row);
    while ($row = $db->sql_fetchrow($result)) {
        $template->assign_block_vars('loop', array(
            'VAR1' => $row['ip_plant_type'],
            'VAR2' => $row['plant_type'],
            'VAR3' => number_format($row['plant_spacing'], 2),
            'VAR4' =>  date('Y-m-d H:i:s', $row['plant_create_date']),
            'VAR5' => checkip($row['plant_user_ip']),
        ));
    }
้html

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

 <!-- BEGIN loop -->
                                <tr class="bg1">
                                    <td> <span class=""></span>
                                        <font size="1"><a href="./planting_tool.php?action=show&&id={loop.VAR1}">{loop.VAR1} </a>
                                        </font>
                                    </td>
                                    <td> <span class=""></span>
                                        <font size="1"><a href="./planting_tool.php?action=show&&id={loop.VAR1}">{loop.VAR2} </a>
                                        </font>
                                    </td>
                                    <td>
                                        <font size="1"><a href="./planting_tool.php?action=show&&id={loop.VAR1}">{loop.VAR3}</a>
                                        </font>
                                    </td>
                                    <td>
                                        <font size="1"><dfn style="display: none;"> </dfn><a
                                                href="./planting_tool.php?action=show&&id={loop.VAR1}">{loop..VAR4}</a> </font>
                                    </td>
                                    <td>
                                        <font size="1"><dfn style="display: none;"> </dfn><a
                                                href="./planting_tool.php?action=show&&id={loop.VAR1}">{loop.VAR5} </a></font>
                                    </td>
                                    <td width="75" align="">
                                        <font size="1"><a href="./planting_tool.php?action=show_admin&&id={loop.VAR1}">{L_DESCRIPSION_AREA}</a> </font>
                                    </td>
                                </tr>
 <!-- END loop -->
:gfb:
flook
PHP VIP Members
PHP VIP Members
โพสต์: 3751
ลงทะเบียนเมื่อ: 06/06/2022 9:43 am

Re: สอบถามการแปลง timestamp บน database

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

Thanapoom1514 เขียน: 09/08/2022 12:13 pm สอบถามแปลง timestamp บน database ต้องแปลงยังไงครับ และในหน้าแสดงผลมันขึ้น array ของช่องเวลาการอัปเดตต้องทำยังไงครับ
หน้าจอแสดงผล
print_r.png
หน้าจอแสดงผล.png

php

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

 $start = request_var('start', 0);
    $limit = 10;
    $sql_array = array(
        'SELECT'    => '*',
        'FROM'     => array(
            'tools_plant_type' => 't',
        ),
        'ORDER_BY' => 'id DESC',
    '');
    
    $sql = $db->sql_build_query('SELECT', $sql_array);
    $result = $db->sql_query_limit($sql, $limit, $start);
    $row = $db->sql_fetchrow($result);
    print_r( $row);
    while ($row = $db->sql_fetchrow($result)) {
        $template->assign_block_vars('loop', array(
            'VAR1' => $row['ip_plant_type'],
            'VAR2' => $row['plant_type'],
            'VAR3' => number_format($row['plant_spacing'], 2),
            'VAR4' =>  date('Y-m-d H:i:s', $row['plant_create_date']),
            'VAR5' => checkip($row['plant_user_ip']),
        ));
    }
้html

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

 <!-- BEGIN loop -->
                                <tr class="bg1">
                                    <td> <span class=""></span>
                                        <font size="1"><a href="./planting_tool.php?action=show&&id={loop.VAR1}">{loop.VAR1} </a>
                                        </font>
                                    </td>
                                    <td> <span class=""></span>
                                        <font size="1"><a href="./planting_tool.php?action=show&&id={loop.VAR1}">{loop.VAR2} </a>
                                        </font>
                                    </td>
                                    <td>
                                        <font size="1"><a href="./planting_tool.php?action=show&&id={loop.VAR1}">{loop.VAR3}</a>
                                        </font>
                                    </td>
                                    <td>
                                        <font size="1"><dfn style="display: none;"> </dfn><a
                                                href="./planting_tool.php?action=show&&id={loop.VAR1}">{loop..VAR4}</a> </font>
                                    </td>
                                    <td>
                                        <font size="1"><dfn style="display: none;"> </dfn><a
                                                href="./planting_tool.php?action=show&&id={loop.VAR1}">{loop.VAR5} </a></font>
                                    </td>
                                    <td width="75" align="">
                                        <font size="1"><a href="./planting_tool.php?action=show_admin&&id={loop.VAR1}">{L_DESCRIPSION_AREA}</a> </font>
                                    </td>
                                </tr>
 <!-- END loop -->
loop..VAR4} จุดเกินมาเปล่าครับ
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

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

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