1

I want to show the updated values via php since the time i login my page not the previous values. How can i do that. Especially, the data will update frequently and i want to update the data table in my page continuously.

JackABC
  • 27
  • 2
  • 7

1 Answers1

2

You can use nodejs with php to update real time data. The mysql query LISTEN and NOTIFY along with triggers you can have NOTIFY events fire when certain queries are performed on specific tables with nodejs.

This links may helpful.

http://nodejs.org/

http://bjorngylling.com/2011-04-13/postgres-listen-notify-with-node-js.html

IshaS
  • 837
  • 1
  • 10
  • 31
  • 1
    What has nodejs to do with this question? He didn't even mention that as a technology he is using for the development. :| – Nagaraj Tantri Sep 26 '14 at 03:30
  • He is using php and he want to display real time data.It can be displayed real time data by using nodejs server. – IshaS Sep 26 '14 at 03:32
  • Still, I mean he is asking things like, if he is using PHP with MySQL, how can he showcase the latest updated data. He can do it with a query to Mysql from PHP.. Why introduce NodeJS? :) – Nagaraj Tantri Sep 26 '14 at 03:35
  • Yes he can do it mysql and php but he can't update the web page without page refresh without using any server or technology like nodejs. – IshaS Sep 26 '14 at 03:38
  • no AJAX can't update the page when update the databse.for use to AJAX need fire an event like onload,mouseclick,hover.If someone want to load the data as soon as database update he have to use different technology. – IshaS Sep 26 '14 at 03:49
  • I don't think you are correct on that: http://stackoverflow.com/questions/16707648/using-jquery-ajax-to-retrieve-data-from-mysql#answer-16894623 – Nagaraj Tantri Sep 26 '14 at 03:51
  • For that question, he has displayed data "click" event.this is a different scenario.@Dũng wants to display data after he log when database is updating.what is the event if you use AJAX here? – IshaS Sep 26 '14 at 03:55
  • Once he logs in, he can have an event listener which can then send AJAX request, you don't need to have just `click` event, there is onload of sort and do it. Trust me he can achieve it. – Nagaraj Tantri Sep 26 '14 at 03:57
  • If it want to data after page loding.not onload event. – IshaS Sep 26 '14 at 03:59
  • Once he logs in, he can use the success callback (if login is ajax or post back) to fetch the datetime from mysql via ajax. You don't have to literally consider waiting for page loaded scenario. There is no need for NodeJs at all. :) – Nagaraj Tantri Sep 26 '14 at 04:06
  • thank to every one. Finally, i finded out the solution for my case – JackABC Sep 26 '14 at 12:39