[eluser]mikeymayhem[/eluser]
Hey
the function works as long as i use the result_array() func instead of the result() func
heres what i got back from
$test = $gigs->result()
i think the problem lies in trying to ad more result objects to $gigs_list[] array
Code:
array(2) {
[0]=>
object(stdClass)#18 (21) {
["id"]=>
string(1) "6"
["user_id"]=>
string(1) "1"
["venue_id"]=>
string(1) "1"
["flyer_id"]=>
string(1) "1"
["headline"]=>
string(1) "1"
["content"]=>
string(443) "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut tortor nibh. Phasellus suscipit vehicula nisi volutpat consectetur. Aliquam eget condimentum magna. Cras non odio quis ligula placerat tempus in vel enim. Integer luctus libero eu nisi rhoncus at adipiscing est ultrices. Integer ipsum urna, suscipit eu accumsan vitae, fringilla a nisl. Duis quam massa, egestas sit amet facilisis eu, tincidunt eget elit. Suspendisse potenti."
["date"]=>
string(10) "2010-12-31"
["start_time"]=>
string(8) "20:00:00"
["end_time"]=>
string(8) "03:00:00"
["views"]=>
string(3) "134"
["created"]=>
string(19) "2010-12-30 16:08:45"
["updated"]=>
string(19) "2010-12-21 16:08:51"
["status"]=>
string(6) "active"
["gig_date"]=>
string(20) "Friday December 2010"
["venue_name"]=>
NULL
["flyer_url"]=>
string(13) "testflyer.jpg"
["flyer_name"]=>
string(4) "test"
["user_username"]=>
string(10) "MikeWaites"
["gig_id"]=>
NULL
["comment_id"]=>
NULL
["num_comments"]=>
string(1) "0"
}
[1]=>
object(stdClass)#19 (21) {
["id"]=>
string(1) "1"
["user_id"]=>
string(1) "1"
["venue_id"]=>
string(1) "1"
["flyer_id"]=>
string(1) "1"
["headline"]=>
string(19) "Testing the quiries"
["content"]=>
string(331) "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In lacinia, ligula at ultrices viverra, lectus nulla fermentum dolor, quis auctor justo turpis in mi. Nulla facilisi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi nec odio id velit condimentum rutrum id nec sapien. Nullam"
["date"]=>
string(10) "2010-12-19"
["start_time"]=>
string(8) "18:00:00"
["end_time"]=>
string(8) "12:00:00"
["views"]=>
string(1) "1"
["created"]=>
string(19) "2010-12-19 16:10:11"
["updated"]=>
string(19) "2010-12-19 16:10:14"
["status"]=>
string(6) "active"
["gig_date"]=>
string(20) "Sunday December 2010"
["venue_name"]=>
NULL
["flyer_url"]=>
string(13) "testflyer.jpg"
["flyer_name"]=>
string(4) "test"
["user_username"]=>
string(10) "MikeWaites"
["gig_id"]=>
string(1) "1"
["comment_id"]=>
string(1) "1"
["num_comments"]=>
string(1) "2"
}
}
i think i may have some problems with my query to as its only returning 2 results even though i have 24 in the db. I cant for the life of me figure out why! heres my query.... its raw sql at the moment!
Code:
function get_gigs()
{
$sql = "SELECT `gigs`.*, DATE_FORMAT(`date`,'%W %M %Y') AS gig_date, `venues`.`name` AS `venue_name`, `flyers`.`img_url` AS `flyer_url`, `flyers`.`img_name` AS flyer_name,
`users`.`username` AS `user_username`,
`comments_gigs`.`gig_id`, `comments_gigs`.`comment_id`,
COUNT(comments.id) AS num_comments
FROM (`gigs`)
LEFT OUTER JOIN `venues` venues ON `venues`.`id` = `gigs`.`venue_id`
LEFT OUTER JOIN `flyers` flyers ON `flyers`.id = `gigs`.flyer_id
LEFT OUTER JOIN `users` users ON `users`.id = `gigs`.user_id
LEFT OUTER JOIN `comments_gigs` comments_gigs ON `comments_gigs`.gig_id = `gigs`.id
LEFT JOIN `comments` comments ON `comments`.id = `comments_gigs`.comment_id GROUP BY(gig_id)
ORDER BY gigs.created DESC";
return $this->db->query($sql);
}
Thanks alot for your help!