db = $db; } public function noEmptySpaces($event_id, $reservations) { $sql = "SELECT ace.max_num, ace.buffer, ace.participants FROM llx_actioncomm as ac INNER JOIN llx_actioncomm_extrafields as ace ON ace.fk_object = ac.id WHERE ac.id = {$event_id}"; //print $sql;exit; $result = $this->db->query($sql); if ($this->db->num_rows($result) == 0) { return true; } while ($row = $this->db->fetch_object($result)) { if($row->participants >= $row->max_num){ return true; } if($row->participants + $reservations > $row->max_num + $row->buffer){ return true; } } return false; } }