Im developing a web chat and was wondering, when Im displaying recent messages how do I get individual usernames to display. For example: when i log in as a user and send a message, it shows that its from me, but when I log in as a different user, all the messages are from that particular user ? Im not sure how to make it show the different user names. Any help would be apreciated.
Thanks,
Jessica.
jessicam93xx
0
Newbie Poster
Recommended Answers
Jump to PostMySQL doesn't insist on constraints (FKs), but anyway:
This all depends upon whether you want the usernames to be volatile or stored in your db for further use in another session. If the latter, then you'll need to store email data for when an user loses their password etc, and …
Jump to PostPerhaps your chat app should just show the comments from the time that the user joins the conversation (like irc). So, your users will have a timestamp when they join the conversation and only comments from then on will appear in the user's window. Also, msgs should be in order …
Jump to Posti think so, it can be spacing problem.
$query="SELECT * FROM messages ORDER BY id_msg DESC";
You can check first "SELECT * FROM messages ORDER BY id_msg DESC" in your MySQL and then in your php chat app
Jump to Postdon't use this if you want to show only 10 or 15 results.
You can use LIMIT clause$query="SELECT * FROM messages ORDER BY id_msg DESC LIMIT 10";
Jump to PostAlso it's mysql_num_rows not mysql_numrows
You need to pay attention to your spacing (as previously mentioned) and spelling of functions. These will trip you up even if your algorithm is sound.
Ajax is asynchronous - so some issues may come from this if you're running a few at a time. …
All 31 Replies
skliz
0
Unverified User
jessicam93xx
0
Newbie Poster
diafol
jessicam93xx
0
Newbie Poster
jessicam93xx
0
Newbie Poster
jessicam93xx
0
Newbie Poster
skliz
0
Unverified User
diafol
jessicam93xx
0
Newbie Poster
diafol
mendpara.sukunj27
0
Newbie Poster
diafol
jessicam93xx
0
Newbie Poster
IIM
163
Master Poster
jessicam93xx
0
Newbie Poster
IIM
163
Master Poster
jessicam93xx
0
Newbie Poster
jessicam93xx
0
Newbie Poster
jessicam93xx
0
Newbie Poster
IIM
163
Master Poster
jessicam93xx
0
Newbie Poster
IIM
163
Master Poster
jessicam93xx
0
Newbie Poster
IIM
163
Master Poster
jessicam93xx
0
Newbie Poster
IIM
163
Master Poster
diafol
jessicam93xx
0
Newbie Poster
skliz
0
Unverified User
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.