note 124093 added to pdostatement.fetchall
| From: | LeonardoCostalinux at linuxmanbr dot com dot br | Date: | Mon, 05 Aug 2019 21:08:24 +0000 |
| Subject: | note 124093 added to pdostatement.fetchall | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-211820@lists.php.net to get a copy of this message | ||
Method with Return object (PHP 7.2)
class MySql {
public function __construct()
{
parent::__construct();
try{
$options = array
(
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES UTF8"
);
$this->pdo = new PDO('mysql:host=127.0.0.1;dbname=testuser','dbtest',
'xxxxxxx',$options);
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}catch(PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
}
public function selectAll(string $sql)
{
$conn = $this->pdo->query($sql);
return $conn->fetchAll(PDO::FETCH_OBJ);
}
}
----
Server IP: 208.43.231.9
Probable Submitter: 82.199.157.54 (proxied: 201.17.156.123)
----
Manual Page -- http://php.net/manual/en/pdostatement.fetchall.php
Edit -- https://master.php.net/note/edit/124093
Del: integrated -- https://master.php.net/note/delete/124093/integrated
Del: useless -- https://master.php.net/note/delete/124093/useless
Del: bad code -- https://master.php.net/note/delete/124093/bad+code
Del: spam -- https://master.php.net/note/delete/124093/spam
Del: non-english -- https://master.php.net/note/delete/124093/non-english
Del: in docs -- https://master.php.net/note/delete/124093/in+docs
Del: other reasons-- https://master.php.net/note/delete/124093
Reject -- https://master.php.net/note/reject/124093
Search -- https://master.php.net/manage/user-notes.php