function muestraInvitaciones($id){ $sql = "SELECT id, nombre,apellido, email FROM usuarios, invitaciones where id=invita and invitado=$id"; $result = $this->databaseUpdate($sql); $searchResults = array(); while ($row = $this->conn->nextRow($result)) { $temp = new usuarioModel(); $temp->setId($row[0]); $temp->setNombre($row[1]); $temp->setApellido($row[2]); $temp->setEmail($row[3]); array_push($searchResults, $temp); } if(count($searchResults)) return $searchResults; return false; }
function buscaAmigos($idUser) { $sql = "SELECT * FROM relaciones WHERE id='".$idUser."' OR idbis='".$idUser."'"; $amigos = array(); $searchResults = array(); $result = $this->conn->execute($sql); while ($row = $this->conn->nextRow($result)) { $id = $row[0]; $idbis = $row[1]; if($id == $idUser) array_push($amigos, $idbis); else array_push($amigos, $id); } $ids = implode(',', $amigos); $sql = "SELECT id, nombre, apellido, email FROM usuarios WHERE id IN ($ids)"; if(strlen($ids)>0){ $result = $this->conn->execute($sql); $amigos=NULL; $amigos = array(); while ($row = $this->conn->nextRow($result)) { $temp = new usuarioModel(); $temp->setid($row[0]); $temp->setNombre($row[1]); $temp->setApellido($row[2]); $temp->setEmail($row[3]); array_push($searchResults, $temp); } return $searchResults; } return false; }