Hoping someone can help me out with a problem. it appears to be a syntax problem but I can't hammer down what exactly the problem is... I am using the latest version of mysql
I am getting this error:
"Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:...\testing_album_func.php on line 14"
Here is my code:
function get_listings() {
$listings = array();
$listings_query = mysql_query("SELECT `class_ads`.`ad_id`, `class_ads`.`created_on`,
LEFT(`class_ads`.`title`, 50) as `title`, LEFT(`class_ads`.`description`, 50) as
`description`, `class_ads`.`price`, `class_ads`.`quantity`,
COUNT(`images`.`image_id`) as `image_count` FROM `class_ads` LEFT JOIN `images` ON
`class_ads`.`ad_id`=`images`.`ad_id` WHERE `user_id`='".$_SESSION['user_id']."' GROUP
BY `class_ads`.`ad_id`");
while ($listings_row= mysql_fetch_assoc($listings_query)) {
$listings[] = array(
'ad_id' => $listings_row['ad_id'],
'created_on' => $listings_row['created_on'],
'title' => $listings_row['title'],
'description' => $listings_row['description'],
'price' => $listings_row['price'],
'quantity' => $listings_row['quantity'],
'image_count' => $listings_row['image_count']
);
}
return $listings;
}