Good afternoon guys, I'm having a problem with my DB, but I do not know how to solve it, the error is this:
Parse error: syntax error, unexpected '[' in /home/storage/2/3e/eb/noticiasdasgerais/public_html/yteste/Lib/DB.php on line 44
The line of code 44 is:
public function fetchAll($sql) {
if ($this->pagination == true) {
$res = $this->con->query($sql) or die($this->con->errorInfo()[2]); //tratamento de exceções Linha 44
$this->rows = count($res->fetchAll(PDO::FETCH_OBJ));
$this->paginateLink();
$sql .= " LIMIT $this->page, $this->perpage";
$this->pagination = false;
}
$res = $this->con->query($sql) or die($this->con->errorInfo()[2]); //tratamento de exceções
if ($res) {
$this->data = $res->fetchAll(PDO::FETCH_OBJ);
return $this->data;
}
}
Alias the php version of my hosting is 5.2