Jump to content

PDO query statement


terryds

Recommended Posts

I found this in someone's code

 

$query = $this->db->query($string, PDO::FETCH_BOTH);

 

 

The query statement there is using PDO::FETCH_BOTH...

 

What i know that we use PDO::FETCH_BOTH in fetch statement only....

 

Can you tell me the use of it?

 

Does it fetch the queried string directly ?

 

But, i do a test, then i see nothing's special

 

try {
$sql = 'SELECT * from author WHERE 1';
$s = $pdo->query($sql, PDO::FETCH_BOTH);
}
catch (PDOException $e) {
echo "Error";
exit();
}
var_dump($s);
It shows up like this :
object(PDOStatement)[3]public 'queryString' => string 'SELECT * from author WHERE 1' (length=28)
So, what's the deal of using PDO::FETCH_BOTH in a query statement ?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...