radar Posted September 19, 2006 Share Posted September 19, 2006 Okay I have a site that has different institutions and different advisors.. I need a list of the different advisors split up by their institutions and in alphabetical order... Im not sure where to go from the code I have.. Now I am using smarty but all that works...[code]<?phpcase 'list_all_advisors'; /* $data = $turbo->get_all("SELECT advisors.fname, advisors.lname, advisors.advisor_id, count(*) as tot_rec, avg(total_score) as avg_score, recommendations.total_score FROM advisors, recommendations WHERE advisors.advisor_id = recommendations.advisor_id GROUP BY advisor_id"); /// */ $data = $turbo->get_all("SELECT advisors.fname, advisors.lname, advisors.advisor_id, advisors.institute_id, count(recommendations.rec_id) as tot_rec, avg(recommendations.total_score) as avg_score, recommendations.total_score FROM recommendations RIGHT JOIN advisors ON recommendations.advisor_id = advisors.advisor_id GROUP BY advisors.institute_id");//$data = $turbo->get_all("SELECT advisors.fname, advisors.lname, advisors.advisor_id FROM advisors ORDER BY advisors.lname"); $i = 0; foreach ($data as $this_adv){ $adv_stats = $turbo->get_stats_adv($this_adv[advisor_id]); $data[$i][sd] = $adv_stats[sd]; $data[$i][av] = $adv_stats[av]; $i++; } $turbo->assign('rec', $rec); $turbo->assign('data',$data); //print_r($data); //print_r($adv_stats); $page = 'list_advisors'; break;?>[/code]I found the real cause of my problems and the post has been edited acordingly. any help on this is greatly appreciated... Quote Link to comment https://forums.phpfreaks.com/topic/21305-splitting-queries-or-something/ Share on other sites More sharing options...
radar Posted September 25, 2006 Author Share Posted September 25, 2006 anyone know about this? Quote Link to comment https://forums.phpfreaks.com/topic/21305-splitting-queries-or-something/#findComment-98257 Share on other sites More sharing options...
HuggieBear Posted September 25, 2006 Share Posted September 25, 2006 [quote author=radar link=topic=108666.msg437413#msg437413 date=1158689653]I found the real cause of my problems and the post has been edited acordingly.[/quote]So what's the problem now then?RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/21305-splitting-queries-or-something/#findComment-98280 Share on other sites More sharing options...
radar Posted September 28, 2006 Author Share Posted September 28, 2006 Same thing -- Just didnt have the right piece of code before -- but now I do... Quote Link to comment https://forums.phpfreaks.com/topic/21305-splitting-queries-or-something/#findComment-100305 Share on other sites More sharing options...
Barand Posted September 28, 2006 Share Posted September 28, 2006 Substitute institution and advisor for letter and topic in thishttp://www.phpfreaks.com/forums/index.php/topic,108758.msg443126.html#msg443126 Quote Link to comment https://forums.phpfreaks.com/topic/21305-splitting-queries-or-something/#findComment-100385 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.