zac_exuro Posted February 25, 2011 Share Posted February 25, 2011 im trying to get new user messages to show up on my site.. i have looked around on google but can only find info on popup alerts.. i just need a simple javscript code that will display the number of new messages next to the link that takes them to their inbox.. if someone could point me to a site or if they have the code handy i would appreciate it more than you know.. thank you Quote Link to comment Share on other sites More sharing options...
codefossa Posted February 25, 2011 Share Posted February 25, 2011 Add a `read` column to the database table, and use a query to count the number of messages to that ID that has the read column 0, and once they visit their messages, or an individual message, mark `read` = '1' Quote Link to comment Share on other sites More sharing options...
zac_exuro Posted February 26, 2011 Author Share Posted February 26, 2011 thanks for your input.. i have this already in database.. and members get alerted when they have a new message but page has to be refreshed in order to see the alert because it is not javascript.. i dont know where to start.. i was looking for a script on google i can modify and make work for me but i cannot find any.. if someone could point me in the right direction.............. Quote Link to comment Share on other sites More sharing options...
zac_exuro Posted February 26, 2011 Author Share Posted February 26, 2011 i dont know if this will help or not but this is what the message table looks like.. (still under construction obviously) lol Quote Link to comment Share on other sites More sharing options...
haku Posted February 26, 2011 Share Posted February 26, 2011 This is done server side, not with javascript. Moving thread to php forum. Quote Link to comment Share on other sites More sharing options...
zac_exuro Posted February 26, 2011 Author Share Posted February 26, 2011 this is the code as is right now.. i dont know why this was moved to php when im needing javascript so messages alerts show in real time.. but im a noob too so you guys probably know why.. <div align="center"> <? if ($msg_type == "") { $msid = $myrow[id]; $msql = "SELECT count(*) from og_messages where toid=$msid AND checked=0 AND type like '1%' order by id DESC"; $mresult = @mysql_query($msql); $mmyrow = @mysql_fetch_array($mresult); $msql1 = "SELECT count(*) from og_messages where toid=$msid AND checked=0 AND type like '2%' order by id DESC"; $mresult1 = @mysql_query($msql1); $mmyrow1 = @mysql_fetch_array($mresult1); $msql2 = "SELECT count(*) from og_messages where toid=$msid AND checked=0 AND type like '3%' order by id DESC"; $mresult2 = @mysql_query($msql2); $mmyrow2 = @mysql_fetch_array($mresult2); $sqlpl = "SELECT * from og_userinfo where uid='$uid'"; $resultpl = @mysql_query($sqlpl); $myrowpl1 = @mysql_fetch_array($resultpl); if ($mmyrow[0] > 0) { ?> </p> </div> Quote Link to comment Share on other sites More sharing options...
zac_exuro Posted February 27, 2011 Author Share Posted February 27, 2011 this forum is super.. non-helpful.. thanks to the couple who have tried.. i will browse around for a better community though.. later Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.