Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,528 members, 7,819,904 topics. Date: Tuesday, 07 May 2024 at 06:05 AM

Php Reply Problem. - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Php Reply Problem. (1114 Views)

Need Help On How To Create A Php Code Code That Will Reply My Chat When Am Offli / Reply To Mysteries That MICROSOFT Could Not Explain To Us! / Help Me Figure This And I Will Recharge Your Phone N200 In Reply (2) (3) (4)

(1) (Reply) (Go Down)

Php Reply Problem. by Dlastofmykind(m): 12:35am 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' logs 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 Problem. by abdul01(m): 7:42pm On Dec 16, 2014
I guess u'r trying to achieve an instantaneous and seamless interaction btw d two parties(like a live chat), if that's d case then u need to use AJAX, n d best way to achieve that is to use either JQuery(old school but still popular) or AngularJS
Re: Php Reply Problem. by Kidstell: 10:50am On Dec 17, 2014
I have a feel of pms, since the page will have to load afresh for each parties to view their messages it is good that you create an sql query to read all the past messages and sort by date. Eg
Select * from box where sender=css or sender=php or reciever =css or reciever=php order by date asc limit 10
Then loop through this result, the most recent message will be the first on the list if your date has this format (yyyy/mm/dd h:i:s) the time there is optional but it is a good feature for pms...
Limit 10 is also optional.
I guess what you were doing before was to load only the most recent message. You can continue with that so that you can display the most recent message in a different place than the past messages. So when you are looping thru the query i presnted earlier. Remenber to skip the first result so i=1 not i=0... It depends on your creative choice
Re: Php Reply Problem. by finfreedom(m): 1:28am On Dec 20, 2014
Dlastofmykind:
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' logs 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.


If what you are trying to achieve is chat, then follow what @abdul01 said. However, if you are trying to achieve a messaging system that mimics a normal e-mail box, then, you would have to modify your table structure a bit. Add a new column named (say) thread_id so that your table definition would now be something like this

message_id, sender, recipient, message, thread_id

"thread_id" should contain "message_id" of the first message that sent in the thread, which is what would tie all those messages (sent by php to css, css to php, php to css again) together.

Kind regards.
Re: Php Reply Problem. by DebbiegKeene: 9:37pm On Aug 02, 2020
This had become common problem for lot of members who had installed latest version of this software which is downloaded from best assignment help service blog as they are facing provable reply message option. Company is going to release the new patch to solve the bug problem.
Re: Php Reply Problem. by Mrchusenvessel(m): 2:30am On Aug 03, 2020
Simple...carry all messages that has css as sender && php as receiver .. then limit and display

I think that's what you want to achieve

1 Like

Re: Php Reply Problem. by Kehcsc(m): 12:45am On Aug 04, 2020
I think what you are asking for is how to limit the number of character from each of the message before viewing the details(more like what happens in mail box) if that's the case then u should follow follow what Mrchusenvessel just said. A php substr function could do that for u something like echo substr ('message', 0, 20)...;

(1) (Reply)

simple ad Code / Share Ur Installed Android Apps With Friends And Files Of All Format Via Whatapp / Javafx FXML Help Needed.

(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. 25
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.