dongpengyu1363 2015-10-20 13:47
浏览 5
已采纳

如何检查mysql中的行是否收到了对现有表的任何更新?

I have a table in mysql and two web pages 1)admin.php 2)student.php. in admin.php web page he inserts records of students.

$sql = "insert into student_data values('$p_id','$p_name','$p_surname','$p_email','$address','$circle','$p_cont','$loc' ,'$user_p','$pass_p','$title')";
             $data = mysql_query($sql,$conn);

             if($data)
             {
             echo $p_name ." account created";
             }
             else
             {
echo "insertion not successful"; echo mysql_error();

and in the second page i.e. student.php these records are retrieved

<?php include"config.php"; 
                $sqli = mysql_query("select * from student_data where p_id='$name_perm'",$conn);
                while($rows = mysql_fetch_array($sqli))

                {
                echo '<div class="gallerycontainer">';
                    echo '<table>';

            echo '<tr>';
            echo '<td class="thumbnail" href="#thumb"><img height="120" width="200" src="data:image;base64,'.$rows['Image']. '"> <span><img height="240" width="400" src="data:image;base64,'.$rows['Image']. '" /></td>';
            echo '<td>'.$rows['p_name'].'</td>';
            echo '<td>'.$rows['p_surname'].'</td></tr>';
            echo '</table>';
            echo '</div>';
                }

in a table format and students can see all the records. this is just an example.

now what I want is that, student wants to update his information so, HE REQUESTS ADMIN TO DO THE CHANGES. in student.php there is update section and he fills out the form and submits it.

ON THE ADMIN SIDE> when admin logs in, he gets a notification that there is a update request from student side. he reviews it and do the necessary change.

for now, I made a table called update_request , students fills the form and insert the record in those table. there is already stack of updates received by students and just want the admin to be notified that, a new record has been inserted and this is the record, kindly do the change.

  • 写回答

1条回答 默认 最新

  • dongtou9934 2015-10-20 14:01
    关注

    I don't have enough reputation to comment so I'll answer here.

    Why not add a status column to your update_request table? Example : If you add a new record to update_request, the status is 0 or pending, when an admin logins you retrive all records that are status 0. When the admin treats the request, you update the record to status 1 or completed.

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

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度