Pretty short question, here is an example:
$prepared = $this->pdo->prepare(\"SELECT * FROM Users WHERE ID = :ID\");
$statement = $prepared->execute(
Very short answer: Yes it will.
class Foo
{
private $id;
public function echoID()
{
echo $this->id;
}
}
$result = $statement->fetchAll(PDO::FETCH_CLASS, "Foo");
$result[0]->echoID(); // your ID
Aside:
This will cause syntax errors $statement->fetchAll(PDO::FETCH_INTO, $User);
. You can't use FETCH_INTO
with the fetchAll
method.