Jump to content

Archived

This topic is now archived and is closed to further replies.

radar

Splitting Queries or something

Recommended Posts

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]
<?php
case '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...

Share this post


Link to post
Share on other sites
[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?

Regards
Huggie

Share this post


Link to post
Share on other sites
Same thing -- Just didnt have the right piece of code before -- but now I do...

Share this post


Link to post
Share on other sites
Substitute institution and advisor for letter and topic in this

http://www.phpfreaks.com/forums/index.php/topic,108758.msg443126.html#msg443126

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.