douyan6871 2016-12-14 09:24
浏览 40
已采纳

如何在php中显示datagrid中的单个数据

I have a problem in this code. i want when i press save button then only current data which is saved by me show in table, but my problem is the whole data of table show in grid, how to get rid off this.

//php code
    <?php
            if(isset($_POST['save_button'])){

            $qrydatabind='SELECT first_name,middle_name,last_name,father_name,mother_name,
                              number_of_dependents,dob,gender,identification_mark,marital_status,spouse_name,mobile_number,
                              email_id,adhar_id,pan_number,passport_number,tin_number,dl_number FROM USER_MASTER';
          $results=  mysql_query($qrydatabind) or die(mysql_error());

              while( $row =  mysql_fetch_array( $results ) ) {
                echo
                "
    <table border='2' style= 'background-color: #84ed86; color: #761a9b; margin: 0 auto;' >
          <thead>
                    <tr>
                  <th>First Name</th>
              <th>Last Name</th>
                </tr>
                    </thead>



    <tr>
                  <td>{$row['first_name']}</td>
                  <td>{$row['middle_name']}</td>

                </tr> </table>  ";
            }}
            ?>
  • 写回答

1条回答 默认 最新

  • dpj83664 2016-12-14 09:35
    关注

    You can SELECT with id ORDERBY DESC and then fetch the first row only

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件