Looking For a More Efficient/Elegant Way To Write a MySQL Query I'm querying a MySQL database and displaying the info in order of timestamp (DESC). Essentially, I'm grabbing the last record in the database, displaying it's date and year as the header of it's section and then going backwards from there. I've put together these if and else if statements to display the appropriate month name according to the timestamp. It works fine but I know I could probably do this with an array or some sort of other loop. I'm still learning this type of coding so I was wondering if someone could help me find a way to make this code more efficient. Thanks!

$sql = "SELECT * FROM user ORDER BY timestamp DESC LIMIT 1";
$result = $mysqli-&gt;query($sql);
$row_lastone = mysqli_fetch_array($result);
$timestamp_lastone = date_parse($row_lastone['timestamp']);
$month_lastone = $timestamp_lastone['month'];
$year_lastone = $timestamp_lastone['year'];
if ($month_lastone==1){
$lastone_month = "January";
}
else if ($month_lastone==2){
$lastone_month = "February";
}
else if ($month_lastone==3){
$lastone_month = "March";
}
else if ($month_lastone==4){
$lastone_month = "April";
}
else if ($month_lastone==5){
$lastone_month = "May";
}
else if ($month_lastone==6){
$lastone_month = "June";
}
else if ($month_lastone==7){
$lastone_month = "July";
}
else if ($month_lastone==8){
$lastone_month = "August";
}
else if ($month_lastone==9){
$lastone_month = "September";
}
else if ($month_lastone==10){
$lastone_month = "October";
}
else if ($month_lastone==11){
$lastone_month = "November";
}
else if ($month_lastone==12){
$lastone_month = "December";
}
echo "&lt;h1&gt;".$lastone_month." ".$year_lastone."&lt;/h1&gt;";


Thanks for the help!
Try something like this:

$sql = "SELECT * FROM user ORDER BY timestamp DESC LIMIT 1";
$result = $mysqli-&gt;query($sql);
$row_lastone = mysqli_fetch_array($result);

$date = date("M Y", strtotime($row_lastone['timestamp']));

echo "&lt;h1&gt;".$date."&lt;/h1&gt;";