CodeIgniter Forums
Database Trigger - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Database Trigger (/thread-49472.html)



Database Trigger - El Forum - 02-21-2012

[eluser]Unknown[/eluser]
Hi everyone!

I'm doing a messaging module for my CodeIgniter website.

But I have a problem.

How will I be able to update the number of messages for a current user dynamically every time a user would message him or her?

I'm thinking of having a database trigger, but I don't know how will I work on it.

Thanks!


Database Trigger - El Forum - 02-21-2012

[eluser]johnpeace[/eluser]
You could have an Ajax request that runs every 15-30 seconds and looks for new notifications and updates the HTML when one is found.


Database Trigger - El Forum - 02-21-2012

[eluser]Unknown[/eluser]
[quote author="johnpeace" date="1329846754"]You could have an Ajax request that runs every 15-30 seconds and looks for new notifications and updates the HTML when one is found.[/quote]

I'm still a beginner when it comes to AJAX. Do you have an idea on how to properly implement it?


Database Trigger - El Forum - 02-22-2012

[eluser]Mauricio de Abreu Antunes[/eluser]
Most of the pages i have seen use iframe.
You reload your iframe (with ajax code) searching for any changes. :-)