Chat using php and msql

Asked

Viewed 46 times

-1

I wanted to know how I can with php get the id of another user online, without being by name, because there may be users with the same name. for example pull the id of another user, do not know how to do this (full beginner)

1 answer

0


The ideal is for you to pick up by the user. And the same should be unique so that there is no duplicity. Place the field as UNIQUE in your database and in the application before inserting a new user check that it does not exist.

  • how could I take this person’s name with php, so I can insert it in the comic?

  • I didn’t quite understand your question. All data needed for the chat must be entered by the user via form. To get active users you need to create a field in your user table that you can call active. When the user authenticates on your site you update the active field to 1. And when log out the active field would be 0. That is to say online users are the ones with active field 1.

  • In this case I want to click on the user such and take his name to search the id in the bd and generate a room. Whenever the user goes to talk to Arya person I can bring their messages. I have found more public versions in all users enter with the nick and speak in a single room, in case I wanted a room for each conversation between two users, but I found not one content explaining how to do this.

  • The ideal thing on your link from each user in the online user list is to contain the user id to take the rest of the data and take the required data. The ideal is for you to show what you have done and what you need.

  • I’ll try to do what you told me and then send the code

Browser other questions tagged

You are not signed in. Login or sign up in order to post.