title: returns errors when calling the script
body: <p>I have a code where I call a json for a query with json_encode, but it only returns 1 record, if several users are connected then it repeats the same name for the number of users who are online, code attached</p>
  <pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
  $(document).ready(function() {
      function user() {
          $.ajax({
              dataType: 'json',
              type: &quot;POST&quot;,
              url: &quot;./user_online.php&quot;,
              success: function(response) {
                  let template = '';
                  //
                  $(&quot;.current_users_online_count&quot;).html(response.en_linea);
                  //
                  $.each(response.usuarios, function(k, v) {
                      template += `&lt;a class=&quot;dropdown-item&quot;&gt;&lt;i class=&quot;bx bx-user d-none d-xl-inline-block ml-1 font-size-16&quot;&gt;${v}&lt;/i&gt;&lt;/a&gt;`;
                  });
                  //
                  $('.users_online_holder').html(template);
              }
          });
      }
      setInterval(user, 3000);
  });
  &lt;/script&gt;
  </code></pre>
  <p>here is the code that calls my query</p>
  <pre><code>$linea = mysqli_query($db,&quot;SELECT COUNT(STATUS) as estatus FROM login WHERE status='1'&quot;);
  $linea = mysqli_fetch_assoc($linea);
  $user_online = mysqli_query($db,&quot;SELECT nombre FROM `login` WHERE status='1';&quot;);
  $row_user = mysqli_fetch_array($user_online);
  echo json_encode([ 'en_linea' =&gt; $linea['estatus'], 'usuarios' =&gt; $row_user ]);
  </code></pre>
  <p>This is the code that makes the query and returns to the home page</p>
  <p><img src="https://i.stack.imgur.com/rHUtd.png" alt="enter image description here" /></p>
  <p>Thus, the result tells me the users well, but it does not show their names correctly</p>