Link to home
Start Free TrialLog in
Avatar of APD Toronto
APD TorontoFlag for Canada

asked on

PDO vs MySQLi

HI Experts,

I am currently in the process of starting a large PHP application, and I am wondering which is newer /more recommended, PDO or MySQLi? I find MySQLi easier, especially with its OO approach. Which is the newest and more professional?

As well, I keep reading that in PHP you do not have to destroy objects as it automatically does at the end of the script, is this true?

What about $result->free(); to close the recordset and $db->close() to close the db connection, $statement->close() to close the statement and free up memory.

Thank you,
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of APD Toronto

ASKER

By the way, is it true that MySQLi does not use named parameters?
Short answer to your question - "Yes" - - - - -

I will assume you are talking about using a prepare SQL string and then using "place holders" for the INPUT Data, and then Binding the Variables to the place holders.
mysqli is set up to bind all variables to "place holders" In ONE STEP, as just One method, , the  bind_param( ) method.
So as far as I know, or have seen, you MUST use the question mark   ?   for a place holder, and therefore NO text symbols (named parameters)  like   :param1  are allowed.

you can see examples here -
    http://php.net/manual/en/mysqli-stmt.bind-param.php