Avatars window

Do you know how to make a window (as in VK like Friends, Friends-online)

Well, that is, where 6 av are displayed there and names under them, I made an HTML structure in short, which in VK does not fit into my head, how can I create it. Who knows, tell me?


Answer 1, authority 100%

If you have problems displaying avatars in a row, then either

float:left,

or

display:inline-block

In the general case, it is done something like this, well, so that the text is displayed under the picture – you place the picture in a div, and, there, the text (first name, last name, nickname or something like that) in, for example, more one div or paragraph

If you have a problem with the server logic – correctly formulate the question. In any case, a session in the database is required to count and display users online.


Answer 2

You have a friends table. if you do it in a simple way, then let the table have an active column with true and false, let if the user interacts with the database every time the value is set to true, but after 5 minutes if there are no actions, then set to false, something like this you will find out who he is online) only remains make a request to friends and see who is online. of course everything is done correctly through sessions. well, there you will write an ajax script for the form that makes a get request to the server, and the server gives it friends online in json with an avatar and a nickname. let the script pull friends every minute. something like this