Select all from database then select specific data

Hi, I am trying to select the latest 5 sets of data (title, description, content and image URL of articles) in a table. To get all of them, I am using this:

[php]
$all = array();

$query = “SELECT * FROM articles ORDER BY id DESC LIMIT 10”;
$result = mysqli_query($con, $title_query) or die(mysqli_error($con));
while($row = mysqli_fetch_array($result))
{
//??
}
[/php]

From this, I now need to get the title, description, content and image url fields for the newest 5 articles in the database, then put them into a variable, for example

//Newest article
$title1 = …
$description1 = …
$content1 = …
$imageurl1 = …

$title2 = …
$description2 = …
$conten21 = …
$imageurl2 = …

etc.

Any help is much appreciated. Thanks

Limit by 5, order by primary key field desc

Sponsor our Newsletter | Privacy Policy | Terms of Service