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.

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

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100