Help Needed In Showing Private Chat Messages

Started on the old forum in April 2014 · view the original in the archive · old links redirect here

3 replies · 175 views · started 12 years ago · 1 min read

3 participants
rajveer Developer · 104 posts #1

Hi friends i am learning php and creating a chat site script i am able to show messages from mysql db in chat room but i dont know how to show private messages

by using this code is smarty

  
function chat_messages($rid)
{
   $msgs = array();
   $query = mysql_query("SELECT * FROM chat_messages WHERE room_id = $rid");
   while ($msg_list = mysql_fetch_assoc($query)){
   $msgs[] = $msg_list;
   }
   return $msgs;
}

template code

{foreach from=$msgs item=msg}
<div class="{cycle name="class" values="main,main2"}"><a href="../profile.php?id={$msg.user_id}">{$msg.user_name}</a> : {$msg.message}</a></div>
{/foreach}

i am able to show messages in room name general by id 1 it shows all messages in that room i want to show private msgs to user to whom it is being sended privately i means if user 1 send private msg to user 2 it shows message to only both of them not to user 3 while if message is send to all users it shows to all i hope u understand what i said 😕

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close