Custom database table query
<p>So, I created a custom wp database table (called <code>"wp_my_table"</code>).</p>

<p>I can create a new row or upload values to the table just fine.</p>

<p>But I am new to how to get the values out of the table.</p>

<p>Below is a general database structure:</p>

<p><a href="https://i.stack.imgur.com/0HuDo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0HuDo.png" alt="enter image description here"></a></p>

<p>Each row gets its own <code>ID</code> and also has <code>post_id</code> which is associated with other posts (In this example, there are three different <code>post_id</code>: 433, 6554, 23)</p>

<p>For a query search, I want to be able to search rows with specific <code>post_id</code> in a descent order:</p>

<p>For example:</p>

<ol>
<li>Look for <code>post_id</code> of <code>"433"</code></li>
<li>Get first 2 rows (order by descent date): <code>id=1, 3</code> are selected</li>
<li>Get other info such as <code>contents</code></li>
</ol>

<p>Let say, there is a <code>load more</code> button to load the next set of data (in this case, it will be <code>id=4, 8</code>).</p>

<p>How does it know which row is the next set of data and how do I pull it out?</p>

<p>Any suggestions will be greatly appreciated. I am more interested in php side as I got js part figured out.</p>

<p>Thanks!</p>