I'm wondering if how I gonna display one data at every sitename order by rating? Because what I have now is, display all data order by rating in each site. to be more clear what I really want is this:
if the site is equal of the site column of the person then
site: nameone
- name
- rating: 10
- site name: nameone
site: nametwo
- name
- rating: 10
- site name: nametwo
site: nameone
- name
- rating: 9
- site name: nameone
*and so on*
-----------------------------------------------------
my code so far:
$rowssite = $db->getSiteOrder();
foreach($rowssite as $siterow)
{
$rows = $db->people($siterow['acronym']);
foreach($rows as $row)
{
echo $row['name'] . "<br>";
echo $row['site'] . "<br>";
echo $row['rate'] . "<br>";
}
}
my functions
function getSiteOrder()
{
$query = mysqli_query($this->connect,"SELECT * FROM `dynamic_sites` ORDER BY `site_order` ASC") or die(mysql_error());
while($row = mysqli_fetch_assoc($query))
{
$rows[] = $row;
}
return $rows;
}
function people($siteacronym)
{
$query = mysqli_query($this->connect,"SELECT `person`.`mname` as `fullname`, `person`.`msite` as `site`, `person`.`mtoursrate` as `rating` FROM `person` LEFT JOIN `dynamic_sites` ON `person`.`msite`=`dynamic_sites`.`acronym` WHERE `person`.`msite`='".$siteacronym."' ORDER BY `person`.`mtoursrate` DESC") or die(mysql_error());
while($row = mysqli_fetch_assoc($query))
{
$rows[] = $row;
}
return $rows;
}
thanks in advance guys!