How To Auto Refresh Page On Database Update

I want to update index.php when database is update, how to do?

Help me some example pls.

Now I use auto refresh by time, I think this not work!

Interval ajax request.


As Orey suggested you, you have to make an ajax request each certainly time

make a controller/action that returns whether the database (table(s)) is updated.

Use this data on ajax success response to make refresh or not.

can u get me example?


This simple code (in your view) will give you auto-refresh of your CGridView named ‘event-grid’ every 10 minutes

    Yii::app()->clientScript->registerScript('event_auto_refresh', "

		timeout = 10 * 60 * 1000; // in Milliseconds 


		function refresh() {



		window.setInterval(function(){refresh()}, timeout);