Share on Google+Share on Google+

PDO Fetch Lazy

In this tutorial we will study about PDO Fetch Lazy method in PHP, how to access MySQL using PDO Fetch Lazy method , How to retrieve data etc. Examples will make this clearer.

PDO Fetch Lazy:

PDO::FETCH_LAZY is the combination of PDO::FETCH_OBJ and PDO::FETCH_BOTH. It displays the query which has been made along with the object variable names as they are accessed. Following  example illustrates the idea, and as you see the output, you will find the it displays the query and the field names and their respective values.









$dbh=new PDO("mysql:host=$hostname;dbname=ajax",$user,$password);

$sql="select * from student";






catch(PDOException $c)


echo $c->getMessage();





PDORow Object
    [queryString] => select * from student
    [name] => neeraj
    [roll] => 2


Posted on: April 5, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.