When you connect to the database or the db server, do you create an instance of both classes the PDO() and the PDOStatement()?
If not, how do you perform a query with PDO() and then fetch the information with PDOStatement()?
How do you make the connection that the two instance relate to each other?
Question between PDO() and PDOStatement() classes
Moderator: General Moderators
-
PHPHelpNeeded
- Forum Commoner
- Posts: 83
- Joined: Mon Nov 17, 2014 8:03 pm
Re: Question between PDO() and PDOStatement() classes
You instantiate the PDO class. A PDOStatement object will be returned when you perform PDO::query or PDO::prepare. You shouldn't need to instantiate PDOStatement directly.
-
PHPHelpNeeded
- Forum Commoner
- Posts: 83
- Joined: Mon Nov 17, 2014 8:03 pm