Jump to content

Messaging System - Multiple Users - Textbox Suggesting - Facebook-ish


AshleyByrom

Recommended Posts

Right well here is what I need help with.

 

I have set up a messaging system but it is very basic. It used a MySQL database which stores all the messages I can send and retrieve them etc.

 

The database has a 'touser' column which is filled with the username of the user who should receive the message. My problem is I would like to use some sort of textbox suggesting (like facebook does) so that when you start typing a username a whole list of matching usernames comes up in a little box (preferably showing a 30x30 image of their dp too). The sender can then click the correct user and they are inserted into the To: field.

 

My second problem is i would like a way to send messages to multiple users... I am guessing I would have to do some modifications to my table and the script I use for the To: field would have to support multiple entries too.

 

I would like, if possible, mainly PHP tutorials so I don't have to dive into the unknown javascript, ajax etc. (I'm just about learning PHP)

 

Any help is appreicated! Thanks!

For your first challenge (don't like the word problem) the only solution I see is Ajax. Auto suggest isn't that hard to set up, but you will have to do some reading on that. In a nutshell the script would be calling a php page that would query a table with possible matches every time a letter is entered.

This is a good place to start:

http://www.w3schools.com/php/php_ajax_suggest.asp

i wouldnt query each time a user types a letter, i would pull all the friends once. then sort alphabetically and show the matches as the user types. some would say that querying all the friends is unnecessary, however running one query lasting 4 seconds(for arguments sake) is better than running 20 queries at a second each.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.