Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {"name":"Bocado","street":"887 Howell Mill Rd","city":"Atlanta",
- "state":"GA","zipcode":"30318","firstname":"Prit","lastname":"Patel","email":"ppatel@gmail.com",
- "totalscore":"40","count":"2"}
- {"name":"Bocado","street":"887 Howell Mill Rd","city":"Atlanta",
- "state":"GA","zipcode":"30318","firstname":"Prit","lastname":"Patel","email":"ppatel@gmail.com",
- "totalscore":"40","count":"2", "Complaint1": "Service was bad", "Complaint 2": "I saw a rat on the floor".}
- public function getWorstRestaurant($year, $complaints, $inspectionScore) {
- $json = array();
- $connection = $this->db->getDb();
- $Result = mysqli_query($connection, "select name,
- street, city, state, zipcode, firstname, lastname, o.email,
- max(totalscore) as totalscore, count(*) as count from restaurant
- r join operatorowner o on o.email = r.email join complaint c
- on c.rid = r.rid join (select i.* from inspection i where year(i.idate) = '$year'
- and i.totalscore <= '$inspectionScore' and i.passfail = 'FAIL' order by idate desc limit 1) i on i.rid = r.rid group by name, street, city, state, zipcode, firstname, lastname, email having count(*) >= '$complaints'");
- while ($r = mysqli_fetch_assoc($Result)) {
- $json[] = $r;
- }
- return $json;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement