title: While loop overwrites data every time, how can I work around this?
body: <p>I have the following problem.
  I want to set up a report button with Ajax, this passes certain variables like comment ID, creater from comment.</p>
  <p>As I said I have implemented this with Ajax, so far all good.</p>
  <p>I have as POST in another PHP file my PHP code.</p>
  <p>I have a While loop in which I output all the data from the database.</p>
  <p>Now I want to save and pass this data via SESSION, but this data is overwritten by the While loop every time, how do I fix this?</p>
  <pre><code>$stmt = $pdo-&gt;prepare(&quot;SELECT * FROM threadComments WHERE subThreadsID = ? ORDER BY created_at DESC &quot;);
  $stmt-&gt;execute([$page]);
  while($row = $stmt-&gt;fetch()){
      $createdComments = $row['created_at'];
      $idComment = $row['id'];
      $userlike = $row['userlike'];
      $userid = $row['userid'];
      $username = $row['username'];
      $dateNow = date_create($createdComments, timezone_open('Europe/Berlin'));
      $timeNow = time();
      $seconds = strtotime($createdComments);
      $diffSeconds = $timeNow - $seconds;
      $date = date_format($dateNow, 'd.m.Y - H:i');
  
      $statement = $pdo-&gt;prepare(&quot;SELECT userid, userImage FROM users WHERE userid = ?&quot;);
      $statement-&gt;execute([$userid]);
      $rowImages = $statement-&gt;fetch();
      extract($rowImages);
  
  
      $string = $row['threadContent'];
      $string = convertHashtags($string);
      
      HTML /////
  
      $_SESSION['commentContent'] = $string;
      $_SESSION['commentCreaterID'] = $row['userid'];
      $_SESSION['commentID'] = $row['id'];
  
  }
  ?&gt;
  </code></pre>