PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am working on my site and all works nicely.. BUT.. I have a message system inherited in my script and try to make a warning message when new messages come on, and I cant work it out at all.
Can someone tell me how to do this perhaps?
This picture is of my table for the messages, I think that the trick to display when there are messages marked as unread..
But I have no idea how to grab the info and display it.
I do graphics mostly... I can manage the script fine and all, but adding this PM notification seems beyond me.
I know the table to use and all , but there are lots of users...
How can I make sure that user id 3 gets a warning on the screen saying he has 3 messages ...
$query = "SELECT * FROM `pmTable` WHERE `userIdField` = '".$_SESSION['uid']."' AND `msg_read` = 'no'";
Burrito has kindly shown you an example, but dont stop there, do some research and read around the subject as the above query is not protected against sql injection
Can you show an example of how you would inject anything into a session variable in the case of that query? I am interested in seeing how that particular query is susceptible to injection attack.
Everah wrote:Can you show an example of how you would inject anything into a session variable in the case of that query? I am interested in seeing how that particular query is susceptible to injection attack.