I
I
Ivan2019-11-20 09:34:43
MySQL
Ivan, 2019-11-20 09:34:43

How to get username by id from mysql database?

I'm trying to get the username by id, but as a result I get an Array instead of a name

$user_name = $db->super_query( "SELECT name FROM " . USERPREFIX . "_users WHERE user_id=3 " );
  $user_name = $user_name['name'];

Where is the mistake? Help me fix it please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alams Stoyne, 2019-11-20
@9StarRu

$user_name_super_query = $db->super_query( "SELECT name FROM " . USERPREFIX . "_users WHERE user_id=3 " );
$user_name = $user_name_super_query['name'];
echo $user_name; // Тут будет Имя

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question