1

I want to receive a notification while Mysql database is updating and this notification should stop when the update finish (by adding "NEW"). I want to know the simplest way to do this . Any idea please ?

Thanks

Ben
  • 329
  • 1
  • 3
  • 17

1 Answers1

1

Yii, being a mere PHP framework running on the server, can not do such a thing. This is essential to client-server architecture. The server can not take the initiative to update the client.

The client (i.e. the user computer) can take the initiative. It can send a request to the server. Then, and only then, can the server respond to client.

You will need Javascript running on the client. The Javascript polls the server (via ajax) to see if the database is being updated. If javascript polls and finds that the server responds with: "database complete", then Javascript can add the 'NEW' logo.

Ivo Renkema
  • 2,188
  • 1
  • 29
  • 40
  • many thanks for your explanation Ivo, I am pretty new in the web design and I read many topics in this forum where triggers are used that's why I am confused. From where I should start do you know any good tutorials to do this as you explained ? Many thanks – Ben Feb 10 '13 at 13:55
  • Hi, here are a couple of examples from SO: http://stackoverflow.com/questions/10404721/jquery-polling-using-mysql-and-php-how, http://stackoverflow.com/questions/6835835/jquery-simple-polling-example If you want to know about the server side, google: 'ajax request php server-side' Hope this helps; something like this can seem daunting to a newbie in web design. But even I figured it out eventually; so you can too... – Ivo Renkema Feb 10 '13 at 19:42