RS if/else
Hey Ray
Have got a recordset that I need to wrap in an if, but will be several if and not sure if an if else would be right?
So basically
I need to filter based on if there is a certain value in the StaffJob column and if it satisfies a specific url slug so below would be if the url is /family-children and StaffJob = Head of Family Children then a certain person is placed at the top of the results.
<?php if (strpos($_SERVER['REQUEST_URI'],"/family-children") !== false) { ?>
<?php
$People = new WA_MySQLi_RS("People",$DBConnection,0);
$People->setQuery("SELECT service_contents.*, join_expertise.*, staff.* FROM service_contents INNER JOIN join_expertise ON service_contents.ServicesID = join_expertise.RowsExpertiseContentID INNER JOIN staff ON join_expertise.RowsStaffContentID = staff.StaffID WHERE service_contents.ServicesID = ? GROUP BY StaffID ORDER BY IF(Locate('Head of Family Children',StaffJob)=1,0,1), StaffOrder ASC");
$People->bindParam("i", "".($PageContents->getColumnVal('ServicesID')) ."", "-1"); //WAQB_Param1
$People->execute();
?>
<?php } ?>
I need to do this and check against:
/family-finance / Head of Family Finance
/personal-injury / Head of Personal Injury
/employment / Head of Employment
/court-of-protection / Head of Court of Protection
And then if none are satsified, this recordset gets used
<?php
$People = new WA_MySQLi_RS("People",$DBConnection,0);
$People->setQuery("SELECT service_contents.*, join_expertise.*, staff.* FROM service_contents INNER JOIN join_expertise ON service_contents.ServicesID = join_expertise.RowsExpertiseContentID INNER JOIN staff ON join_expertise.RowsStaffContentID = staff.StaffID WHERE service_contents.ServicesID = ? GROUP BY StaffID ORDER BY StaffOrder ASC");
$People->bindParam("i", "".($PageContents->getColumnVal('ServicesID')) ."", "-1"); //WAQB_Param1
$People->execute();
?>
Just not sure how to best do it?
Thanks
Jamie