Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,155,958 members, 7,828,391 topics. Date: Wednesday, 15 May 2024 at 09:06 AM

Php Reply System. - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Php Reply System. (1698 Views)

Do They Accept Our Credit Cards ? Reply From Your Experiences. / Help! Can't Pass Adsense First Stage. Reply Is Insufficient Content Always! / Google Adsense Reply... Any Advice??? (2) (3) (4)

(1) (Reply) (Go Down)

Php Reply System. by Dlastofmykind(m): 12:45am On Dec 16, 2014
Good morning to all programmers in the house.

Please I'm encountering some little problem with the reply aspect of sending messages.

The initial way of sending messages worked but the reply aspect seems not to be working.

In the table created for saving inbox and outbox are 4 columns:

message_id, sender, recipient, message.


Whenever a message is sent, say 'php' is the sender and the recipient is 'css'.... the details of the message is been saved accurately.
But whenever the recipient 'css' log in, he'll be notified of the new message, and after he might have clicked on the link of the message, he'll be redirected to the page where he'll be shown the inbox and a reply box placed underneath.

If the recipient 'css' reply the message sent by 'php' , the sender and the recipient will be saved as 'css' and 'php' respectively.

Now the question is this:

How will it be done in such a way that the replies from both users will be displayed in the view message page wthout the need for the message to be displayed as an entire new message for the recipient.

Thanks.
Re: Php Reply System. by dwebdesign(m): 1:12am On Dec 16, 2014
Create a three dimensional associate array. Do a while loop to echo all messages sent by both ' css' and 'php'. Format the message page using div with specific case properties and values to distinguish 'css' and 'php'.

Query your database, make sure the array is an associative one.

Mysql_fetch_assoc_array()

Then do a for loop or a while loop .

Contact:

Mobile: 08133884165

Whatsapp: 08133884165

BBM : 2BB63350

http://www.1st-website design.com

Hope it helps.
Re: Php Reply System. by spikesC(m): 1:46am On Dec 16, 2014
Your schema is not accurate.
You need another column that dictates when messages are read and who read it last.
Also, what happens when there're multiple interconnection between users.

Nevertheless, the solution would be from your sql query.
Basically,
Select * where (sender = 'css' and receiver = 'php') or (sender = 'php' and receiver = 'css')

This should be the query for displaying the whole thread.

Am not on my PC now, I should have sent you the database schema of the conversation message system as that is what you're trying to build.

Maybe in the day time cool
Re: Php Reply System. by Nobody: 2:57am On Dec 16, 2014
Trollin'
Re: Php Reply System. by spikesC(m): 3:16am On Dec 16, 2014
dhtml18:
Trollin'

This one don pass trolling. This one na winching grin
Re: Php Reply System. by onyengbu: 8:14am On Dec 16, 2014
Among other fields you may have, you need to have the fields below in your table:

ID,
pid,
status,
sender,
receipient,
time

ID will be auto_increment and pid will have a '0' default value.

Now if 'php' sends a message to 'css', insert 'php' into the 'sender' field and 'css' into the receiver field.

If 'css' clicks on the new message link to read/reply it, store the ID of that message and when he submits his reply, insert the ID of the message being replied into the 'pid' field and also make 'css' the sender on this occasion.

When its time to show the message "thread", just select from the table where ID = original_message_ID and pid = original_message_ID.
Loop the result and you will get your messages and their replies.

When you want to list all original messages in the inbox without the replies, just select from your table where pid=0

Status and time fields are for sorting read/unread messages and time messages are sent respectively.
Re: Php Reply System. by Dlastofmykind(m): 7:08pm On Dec 16, 2014
onyengbu:


When its time to show the message "thread", just select from the table where ID = original_message_ID and pid = original_message_ID.

thanks for the reply.

but sir, can you please shed more light on original_message_ID.

Does that means that the variable declared for original_message_ID for column ID will be something like $ID while pid's own will be $pid?

Thanks.
Re: Php Reply System. by Dlastofmykind(m): 7:11pm On Dec 16, 2014
spikesC:
Your schema is not accurate.
You need another column that dictates when messages are read and who read it last.
Also, what happens when there're multiple interconnection between users.

Nevertheless, the solution would be from your sql query.
Basically,
Select * where (sender = 'css' and receiver = 'php') or (sender = 'php' and receiver = 'css')

This should be the query for displaying the whole thread.

Am not on my PC now, I should have sent you the database schema of the conversation message system as that is what you're trying to build.

Maybe in the day time cool

Ok sir.. I'll be expecting it.

Thanks.
Re: Php Reply System. by Dlastofmykind(m): 8:05pm On Dec 16, 2014
onyengbu:
Among other fields you may have, you need to have the fields below in your table:

ID,
pid,
status,
sender,
receipient,
time

ID will be auto_increment and pid will have a '0' default value.

Now if 'php' sends a message to 'css', insert 'php' into the 'sender' field and 'css' into the receiver field.

If 'css' clicks on the new message link to read/reply it, store the ID of that message and when he submits his reply, insert the ID of the message being replied into the 'pid' field and also make 'css' the sender on this occasion.

When its time to show the message "thread", just select from the table where ID = original_message_ID and pid = original_message_ID.
Loop the result and you will get your messages and their replies.

When you want to list all original messages in the inbox without the replies, just select from your table where pid=0

Status and time fields are for sorting read/unread messages and time messages are sent respectively.

just tried it now and it worked!

Thanks so much bro.

I really appreciate!
Re: Php Reply System. by onyengbu: 10:16pm On Dec 16, 2014
Dlastofmykind:


just tried it now and it worked!

Thanks so much bro.

I really appreciate!
Good to know you did it.

Now, is there any APP out there that can you can use to send me 3 bottles of chilled Orijin? cool
Re: Php Reply System. by Dlastofmykind(m): 8:24am On Dec 27, 2014
onyengbu:

Good to know you did it.

Now, is there any APP out there that can you can use to send me 3 bottles of chilled Orijin? cool

lol.. hope 3 bottles will be enough?

Can you please gimme your number?
Re: Php Reply System. by olyivy(f): 4:42pm On Dec 27, 2014
Dlastofmykind:


lol.. hope 3 bottles will be enough?

Can you please gimme your number?
Send me orijin too.

I love that stuff! embarassed
Re: Php Reply System. by onyengbu: 12:38am On Dec 30, 2014
Dlastofmykind:


lol.. hope 3 bottles will be enough?

Can you please gimme your number?

Oya PM me.
Re: Php Reply System. by seromezy: 12:02pm On Oct 20, 2015
onyengbu:


Oya PM me.
Would like to pm u too, Please can u design a website for me with my own idea?
Re: Php Reply System. by onyengbu: 10:36pm On Oct 21, 2015
seromezy:

Would like to pm u too, Please can u design a website for me with my own idea?
PM me then..
Re: Php Reply System. by seromezy: 7:54am On Oct 22, 2015
onyengbu:
PM me then..
I have done that now.
Re: Php Reply System. by onyengbu: 8:58am On Oct 23, 2015
seromezy:

I have done that now.
i have replied you.
Re: Php Reply System. by micodon(m): 10:01am On Oct 23, 2015
The best way to go is to use to normalize ur tables. use three tables for this. one table for your users' info, One table to hold the conversation as a whole, the other table to hold the replies. e.g


users table

id
username
...........



conversations table

Id
user_one (should be an integer and an index referencing your user table)
user_two(same as above)
created_at
updated_at
deleted_at


replies table

Id
conversation_id (integer, index, references conversation.id)
user_id(integer, index, references your user table)
message
read(integer, default should be 0 (which is unread), 1 is read)
created_at
updated_at
deleted_at


So when ever Php starts a conversation with CSS, you create a new conversation with user_one as Php's ID and user_two as CSS's ID. then u make an entry into the replies table with the conversation Id on the conversation table, the user_Id is the person who sent the message.


Always normalize ur database where possible. I'm on WhatsApp 09099010453
Re: Php Reply System. by SamuelMcGilliv: 5:29pm On Apr 21, 2020
Thank you for sharing such kind of wonderful forums with us that are going to be the best one for everyone. Here you can visit https://legitimate-writing-services..com/2018/02/trustmypapercom-review.html to get quality data for your assignment easily. This blog is truly informative and knowledgeable and the data they shared is worthy and admirable.

(1) (Reply)

Bad SEO Practices You Must Not Fall For / 500,000 Members Facebook Group Available For Sale / Wow! I Got Adsense Approval In 6 Hours

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 30
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.