สอบถาม Warning ตรงนี้มันหมายความว่ายังไงคะ

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

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

hayatee
PHP Super Hero Member
PHP Super Hero Member
โพสต์: 670
ลงทะเบียนเมื่อ: 19/04/2021 10:01 am

สอบถาม Warning ตรงนี้มันหมายความว่ายังไงคะ

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

Programming - PHP-1.png

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

 <?php
                    $sql1 = "SELECT * FROM tools_frame_logs ORDER BY id desc Limit 10" ;
                    $result1 = mysqli_query($conn, $sql1);
                    while ($fetch = mysqli_fetch_assoc($result1)) {
                ?>

                    <tr align="center">
                    <td><?php echo $fetch['id']; ?> </td> 
                    <td><?php echo $fetch['user_name']; ?></td>                     
                    <td><?php echo $fetch['template_name']; ?></td>
                    <td><?php echo $fetch['file_before']; ?></td>
                    <td><?php echo $fetch['size_image_before']; ?></td>
                    <td><?php echo $fetch['file_size_before']; ?></td>
                    <td><?php echo $fetch['file_after']; ?></td>
                    <td><?php echo $fetch['size_image_after']; ?></td>
                    <td><?php echo $fetch['file_size_after']; ?></td>
                    <td><?php echo $fetch['resize_optimize']; ?></td>
                   
                    <td class="textcenter">  <?php
                             if ($fetch['create_date']) {
                                 echo  $fetch['create_date'];
                           }
                            ?></td>
                         <td class="text-center">  <?php include 'ip.php'; ?></td>

                    <td>
                        <a href="showhome.php?id=<?php echo $fetch['id']; ?>&lang=<?php echo $lang; ?>">                             
                                <i class="glyphicon glyphicon-new-window"></i>
                            </a>
                        </td>
                        
                    </tr>                    

                    <?php
                 }
                ?>
ภาพประจำตัวสมาชิก
eange08
PHP VIP Members
PHP VIP Members
โพสต์: 16180
ลงทะเบียนเมื่อ: 22/12/2020 10:09 am

Re: สอบถาม Warning ตรงนี้มันหมายความว่ายังไงคะ

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

ลองเช็คตัวแปร $conn ที่เป็นตัวเก็บการ connect กับ database ใช้ชื่อนี้หรือเปล่า

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

$result1 = mysqli_query($conn, $sql1);
ภาพประจำตัวสมาชิก
eange08
PHP VIP Members
PHP VIP Members
โพสต์: 16180
ลงทะเบียนเมื่อ: 22/12/2020 10:09 am

Re: สอบถาม Warning ตรงนี้มันหมายความว่ายังไงคะ

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

hayatee เขียน: 24/05/2021 10:22 am Programming - PHP-1.png


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

 <?php
                    $sql1 = "SELECT * FROM tools_frame_logs ORDER BY id desc Limit 10" ;
                    $result1 = mysqli_query($conn, $sql1);
                    while ($fetch = mysqli_fetch_assoc($result1)) {
                ?>

                    <tr align="center">
                    <td><?php echo $fetch['id']; ?> </td> 
                    <td><?php echo $fetch['user_name']; ?></td>                     
                    <td><?php echo $fetch['template_name']; ?></td>
                    <td><?php echo $fetch['file_before']; ?></td>
                    <td><?php echo $fetch['size_image_before']; ?></td>
                    <td><?php echo $fetch['file_size_before']; ?></td>
                    <td><?php echo $fetch['file_after']; ?></td>
                    <td><?php echo $fetch['size_image_after']; ?></td>
                    <td><?php echo $fetch['file_size_after']; ?></td>
                    <td><?php echo $fetch['resize_optimize']; ?></td>
                   
                    <td class="textcenter">  <?php
                             if ($fetch['create_date']) {
                                 echo  $fetch['create_date'];
                           }
                            ?></td>
                         <td class="text-center">  <?php include 'ip.php'; ?></td>

                    <td>
                        <a href="showhome.php?id=<?php echo $fetch['id']; ?>&lang=<?php echo $lang; ?>">                             
                                <i class="glyphicon glyphicon-new-window"></i>
                            </a>
                        </td>
                        
                    </tr>                    

                    <?php
                 }
                ?>
ดูที่คำสั่ง limit ต้องกำหนดเรคคอร์ดเริ่มต้น, จำนวนเรคคอร์ดที่แสดงในหน้านั้นๆ เช่น

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

SELECT * FROM tools_frame_logs ORDER BY id desc Limit 0,10
หมายถึง 0 = เริ่มต้นเรคคอร์ดแรก, 10 = ในแต่ละหน้าแสดงแค่ 10 เรคคอร์ด
hayatee
PHP Super Hero Member
PHP Super Hero Member
โพสต์: 670
ลงทะเบียนเมื่อ: 19/04/2021 10:01 am

Re: สอบถาม Warning ตรงนี้มันหมายความว่ายังไงคะ

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

eange08 เขียน: 24/05/2021 10:57 am
hayatee เขียน: 24/05/2021 10:22 am Programming - PHP-1.png


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

 <?php
                    $sql1 = "SELECT * FROM tools_frame_logs ORDER BY id desc Limit 10" ;
                    $result1 = mysqli_query($conn, $sql1);
                    while ($fetch = mysqli_fetch_assoc($result1)) {
                ?>

                    <tr align="center">
                    <td><?php echo $fetch['id']; ?> </td> 
                    <td><?php echo $fetch['user_name']; ?></td>                     
                    <td><?php echo $fetch['template_name']; ?></td>
                    <td><?php echo $fetch['file_before']; ?></td>
                    <td><?php echo $fetch['size_image_before']; ?></td>
                    <td><?php echo $fetch['file_size_before']; ?></td>
                    <td><?php echo $fetch['file_after']; ?></td>
                    <td><?php echo $fetch['size_image_after']; ?></td>
                    <td><?php echo $fetch['file_size_after']; ?></td>
                    <td><?php echo $fetch['resize_optimize']; ?></td>
                   
                    <td class="textcenter">  <?php
                             if ($fetch['create_date']) {
                                 echo  $fetch['create_date'];
                           }
                            ?></td>
                         <td class="text-center">  <?php include 'ip.php'; ?></td>

                    <td>
                        <a href="showhome.php?id=<?php echo $fetch['id']; ?>&lang=<?php echo $lang; ?>">                             
                                <i class="glyphicon glyphicon-new-window"></i>
                            </a>
                        </td>
                        
                    </tr>                    

                    <?php
                 }
                ?>
ดูที่คำสั่ง limit ต้องกำหนดเรคคอร์ดเริ่มต้น, จำนวนเรคคอร์ดที่แสดงในหน้านั้นๆ เช่น

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

SELECT * FROM tools_frame_logs ORDER BY id desc Limit 0,10
หมายถึง 0 = เริ่มต้นเรคคอร์ดแรก, 10 = ในแต่ละหน้าแสดงแค่ 10 เรคคอร์ด

แก้ไขเรียบร้อยแล้วค่ะ สามารถโชว์ข้อมูลจาก database ได้แล้ว แต่ยังไม่สมบูรณ์อีกค่ะ
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

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

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