Fwd: About PDO::fetchObject
| From: | Octopus Puras | Date: | Thu, 11 Jun 2015 05:53:42 +0000 |
| Subject: | Fwd: About PDO::fetchObject | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-49038@lists.php.net to get a copy of this message | ||
I have a MySQL table, whose name is Items:
ItemID ItemName ItemDescription
I also have a PHP class:
class Item {
public $id;
public $name;
public $description;
}
If I execute $stmt->fetchObject(), I will get an object with fields of
ItemID, ItemName, etc. But I want to adapt the name of the fields to the
Item class. What should I do?