help needed with MySQL to MySQLi code snippet conversion

2 posts by 2 authors in: Forums > CMS Builder
Last Post: September 18, 2017   (RSS)

By Dave - September 18, 2017

Hi Deborah, 

Try this :

<?php
$query = "SELECT DATE_FORMAT(pubDate, '%M %Y') as dateAndYear, YEAR(pubDate) as year, MONTH(pubDate) as month FROM cmsb_blog GROUP BY dateAndYear ORDER BY pubDate DESC"; 
$result = mysqli()->query($query) or die("MySQL Error: ". htmlspecialchars(mysqli()->error) . "\n"); 
 while ($record = mysqli_fetch_assoc($result)):
?>

Let me know if that works for you!

Dave Edis - Senior Developer
interactivetools.com