Jump to content
Larry Ullman's Book Forums

Pdo::Attr_Emulate_Prepares With Mysql ?

Recommended Posts

Hi guys, i read about PDO in the book, then i read some PDO articles..

Most of the articles say that we should turn off PDO::ATTR_EMULATE_PREPARES if using MYSQL latest driver.. is this true?


i searched some explanation why with recent mysql i should turn of PDO::ATTR_EMULATE_PREPARES, but unfortunately my newbie brain doesn't understand their explanation...


all i know is PDO will send the query to the MYSQL when we use :


$stmt = $pdo->prepare('query');



then PDO will send the data(placeholder's value) :


$stmt->bindValue(':val', $value, PDO::PARAM_STR);



my mysql version :  5.x

php version : 5.4


please guide me here , if possible with example codes

Link to comment
Share on other sites

I would leave it enabled by default, just to be safe. Then, once your application is complete, do benchmarking with it on and off on your production machine in order to decide what to do for that machine. There are a lot of factors here, so there's no one right answer.

Link to comment
Share on other sites


  • Create New...