I'm trying to fetch from a MySQL database to an object of a class I've made. But I can't get it to work. When just replacing PDO::FETCH_CLASS with PDO::FETCH_OBJ to the fetch method, I get the correct values. But I want to use my own class and not stdClass. Any ideas?
$sql = "SELECT...";
$values = array("value 1", "value 2");
$statement = $_SESSION['db']->prepare($sql);
$statement->execute($values);
$statement->setFetchMode(PDO::FETCH_CLASS, 'MyClass', array());
while ($row = $statement->fetch(PDO::FETCH_CLASS))
{
...
}