title: How to select the most recent time in mysql and return two values inside a function
body: <p>I'm trying to return two results from a function, but only the first is showing in on my page.</p>
  
  <p>Here is my function:</p>
  
  <pre><code>function latestcomment($forum_topics){
      $recent = mysql_query(" SELECT created, owner, topic_id
                              FROM forum_comments
                              WHERE topic_id = '".mysql_real_escape_string($forum_topics['topic_id'])."'
                              ORDER BY created DESC 
                              LIMIT 1 ");
      $mostrecent = mysql_fetch_array($recent);
  
      $time = $mostrecent['created'];
      $name = $mostrecent['owner'];
  
      return $time;
      return $name;
  </code></pre>
  
  <p>}</p>
  
  <p>Then I'm calling like this</p>
  
  <pre><code>&lt;?php echo latestcomment($forum_topics); ?&gt;
  </code></pre>
  
  <p>The table I'm calling from looks like this:</p>
  
  <pre><code>+-------+----------+---------------------+------------+
  | id    | body     | created             | owner    |
  +-------+----------+---------------------+------------+
  |     1 |    hello | 2019-12-01 15:50:27 | name1      | 
  |     2 |    World | 2019-12-01 15:50:32 | name2      | 
  |     3 |       Hi | 2019-12-01 15:51:43 | name3      | 
  |     4 |     Over | 2019-12-01 10:20:30 | name4      | 
  +-------+----------+---------------------+------------+
  </code></pre>
  
  <p>Also I'll like to pass the created(DATETIME) part of the returned function into something like this:</p>
  
  <pre><code>           &lt;?php           
              $date = date_create($forum_topics['$time']) ;
              echo  date_format($date, 'F j, Y'); echo"&lt;br&gt;";
              echo  date_format($date, 'g:i A'); 
              ?&gt;
  </code></pre>
  
  <p>using only one query?</p>
  
  <p>How can I do this ?</p>
  
  <p>Thank you.</p>