Welcome Guest, Not a member yet? Register   Sign In
Message Notifications
#1

[eluser]surf66[/eluser]
Hi, I was just wondering about message notifications with CodeIgniter. I have read a few things online about using Ajax and third party libraries etc but I'm not looking for something like that. I was thinking there must be a simple function that can: when the user logs in, count the number of new rows in a db table (Messages) since the last login time and return a number so I can echo it on the dashboard.

If anyone could let me know if this is possible or how I should go about this other wise please let me know. Also I have heard about adding a db row to the messages table called read and when a message is viewed then that row gets checked or something along those lines.

Also sorry if this has been posted before, I spent some time looking on the forum before my post but did'nt come across anything

Thanks
#2

[eluser]Aken[/eluser]
You should have a column in your messages table that specifies if it has been read or not. Could be a true/false or 0/1 style column, or use a timestamp if you want to save the read time. Then you can calculate how many have not been read based on that column.

When you get further into DB optimizing, you could consider having a separate value of read/unread messages that is updated, so that you only need to query that value, rather than an entire DB and retrieving the sum.
#3

[eluser]surf66[/eluser]
Cheers, thanks for you help I thought that may be a way forward i'll look into it thanks!
#4

[eluser]jmadsen[/eluser]
feel free to use an old messaging library I wrote: https://github.com/jrmadsen67/Mahana-Mes...odeIgniter

doesn't have a function for count new messages, but easy to add (might make a good addition, actually)




Theme © iAndrew 2016 - Forum software by © MyBB