Lukeidiot Posted August 22, 2012 Share Posted August 22, 2012 Hey guys, and thanks for reading, I am trying to devise a way to make a pop-up box show whenever a new row is inserted into my MySQL database. Any ideas or suggestions, maybe even an example or helpful information pointing to the right thing will be extremely delightful. Thanks! Link to comment https://forums.phpfreaks.com/topic/267452-php-mysql-pop-up-box-when-a-new-row-is-inserted-in-mysql-database/ Share on other sites More sharing options...
Jessica Posted August 23, 2012 Share Posted August 23, 2012 What code have you written? Are you using any JS libraries? You know it's AJAX cause you posted here, where are you stuck? Link to comment https://forums.phpfreaks.com/topic/267452-php-mysql-pop-up-box-when-a-new-row-is-inserted-in-mysql-database/#findComment-1371638 Share on other sites More sharing options...
xyph Posted August 23, 2012 Share Posted August 23, 2012 You need to run an AJAX call that grabs the id of the 'newest row' from the database. Run this every 5 seconds or so, and store the result in a JS variable. If the value that you fetch is different than the value you've previously stored, you know an update has happened. Link to comment https://forums.phpfreaks.com/topic/267452-php-mysql-pop-up-box-when-a-new-row-is-inserted-in-mysql-database/#findComment-1371643 Share on other sites More sharing options...
Lukeidiot Posted August 26, 2012 Author Share Posted August 26, 2012 You need to run an AJAX call that grabs the id of the 'newest row' from the database. Run this every 5 seconds or so, and store the result in a JS variable. If the value that you fetch is different than the value you've previously stored, you know an update has happened. Hmm I've been trying some things but none have seemed to work out. Perhaps a small example code? Link to comment https://forums.phpfreaks.com/topic/267452-php-mysql-pop-up-box-when-a-new-row-is-inserted-in-mysql-database/#findComment-1372409 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.