How to display results from multiple mysql tables orderd by a date column in one loop
<p>I am using PHP and MYSQL to display an <strong>overview</strong> for the latest user activities.
<img src="https://i.stack.imgur.com/q4ZLO.png" alt="1"></p>

<p>I have like five activities, but lets say we just have two activities (posts and comments), so basically using MYSQL I have to get results from two tables ordered by a date column (all the activities tables have a date column), then using PHP I need to loop through those results and for each result type (either a post or a comment) I need to handle it differently (posts and comments have different html).</p>

<p>The first thing that was on my mind is the <strong>MYSQL UNION ALL Operator</strong> but w3schools says </p>

<blockquote>
  <p>each SELECT statement within the UNION must have the same number of columns. The columns must also have similar data types. Also, the columns in each SELECT statement must be in the same order</p>
</blockquote>

<p>And my posts and comments tables don't have the same number of columns or data types, also I don't know how to handle each result type differently.</p>

<p>I am lost right know, if you could help me in any way that would be great, Thank you.</p>

<h2>Extra</h2>

<p>Here is an example of posts and comments tables</p>

<pre><code>-- Comments table  
id|user_id|post_id|c_date|comment

-- Posts table
id|user_id|p_date|title|content
</code></pre>

<h2>Update1</h2>

<p>I am not trying to join rows, I want to display each row as it's own, not joined it with another row.</p>