About PDO::fetchObject

[email protected] (Octopus Puras) Thu, 11 Jun 2015 14:26:58 +0800
Newsgroups php.db
Message-ID <CAJtdDJ7SARTjN=8rPxSLk6=V3DbrWGbLnv0WdgM5poGjVwbZ5Q@mail.gmail.com>
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?