prepare("SELECT p.id AS post_id,p.title,DATE_FORMAT(p.date_posted,'%M %d %Y') AS date_posted_conv,p.article, p.time_posted,p.active, us.fname, p.file_name FROM posts AS p LEFT JOIN users AS us ON us.id = p.user_id ORDER BY p.id DESC"); $posts->execute(); $posts_count = $posts->rowCount(); if($posts_count==0){ echo "
* There are no posts yet!
"; }else{ //loop through records $post_rows = $posts->fetchAll(PDO::FETCH_ASSOC); ?>