I am very knew to stack overflow and PHP PDO. I have done a lot of research into this but I still can not find a solution. I have a page where you can upload a Title and description to the database. When you upload it, it records the time you uploaded it. I have multiple div's which I wish to display information from the database (HTML below). In these divs I have a TITLE and a DESCRIPTION. I want to be able to display the most recent upload in the first div, second upload in the second div and so on. Here is the div:
<div id="box1" class="box echovshome" onclick="location.href='';">
<h1 style="text-align: left;">Title</h1>
<article>
<p>Description</p>
</article>
</div>
<div id="box2" class="box echovshome" onclick="location.href='';">
<h1 style="text-align: left;">Title</h1>
<article>
<p>Description</p>
</article>
</div>
Is this possible with PHP and PDO. I have got the PHP which selects the information from the Database but I just don't know how to echo it into the divs by the most recent upload. Php code below:
$sql = "SELECT * FROM latest";
$query = mysqli_query($con, $sql);
How can I echo the php data into different divs in order of most recent?
All help appreciated
Thank you