There are, for example, the output of comments from mysql:

function get_comments() { for(...) { $id_author = $uinfo[$i][3]; // id автора, оставившегося комментарий $text_comment = $uinfo[$i][2]; // текст комментария echo "<тут например отобразить аватар юзера> $text_comment"; } } 

So, I wanted to know, you must first write a function to get the avatar of a certain user, and then instead of <here, for example, display the avatar of the user> substitute a function like: user_ava($id_author) . Is it true or not? If not, which method is the right one?

  • Yes, I see nothing wrong with that. - Vfvtnjd
  • aren't there many requests? And if you also deduce the name with the last name, for example .. - ModaL

1 answer 1

You loop through an array of data: $ id_author, $ text_comment. In this array, you need to add information about the avatar and extract it in the same way: $ ava = $ uinfo [$ i] [4] For this, most likely, you will need to extract another field from the database that stores information about the avatar, and more add it to the array. Without seeing the database code and structure, something more specific is difficult to advise.

  • You did not understand the campaign. I do not need to put the avatar in a separate field, but I need to get the current one, so that if it is changed, it will be displayed in a comment in the modified one. - ModaL