doula2426 2015-03-07 14:05
浏览 35
已采纳

如何使用PHP跟踪数据库表中的更新?

I want to ask is there a way to track database table using php mysql. I want to do something like i have a table called post. Now when user post some data other user need to view this data. That is latest one need to be view to user on the top. We can do this by refreshing div after every few sec or using ajax. But can we use Trigger. As we know it automatically fires when something is executed. Hence i want to know can we use trigger in PHP code to automatically detect changes in table. And when a new post is available it needs to return the data from database. Please give me a brief description about this. Thank you in advance.

  • 写回答

2条回答 默认 最新

  • dongmeng4742 2015-03-07 14:13
    关注

    The trigger is executed on Mysql Server, not on the PHP one (even if those are both on the same machine).

    So, I would say this is not quite possible -- at least not simply.

    Still, considering this entry from the MySQL FAQ on Triggers :

    23.5.11: Can triggers call an external application through a UDF?

    Yes. For example, a trigger could invoke the sys_exec() UDF available at MySQL Forge here: http://forge.mysql.com/projects/project.php?id=211

    So, there might be a waty, actually, via an UDF function that would launch the php executable/script ; not that easy, but seems possible ;-)

    Read more about it in:

    https://stackoverflow.com/a/1467387/3653989

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?