Jump to content

Recommended Posts

Yeah, supposedly mysqli is the new and improved way. Some hosts don't have this way available though. I suggest "wrappering" these inside of your own class so that if you need to change them you change them in a single file instead of 8,000 places in your code.

I'll echo everyone else's thoughts, if you are going to use prebuilt php functions, use mysqli_.  If you want to go one step further, as mentioned by a previous poster, use an abstraction layer that would allow you to change the calls within say one class, instead of throughout all your code.  Zend_Db in the Zend Framework works beautifully!

MySQLi provides an interface to some of the more advanced features of MySQL 4.1+, like transactions and prepared statements. The old mysql functions don't.

 

I don't know if their is much reason to use mysqli if you don't use these features, but it doesn't hurt.

I read up on mysqli, and in general it's stated to perform slower before PHP 5.1--there are no tests for beyond that version. As soon as I get home, I can post up a source.

 

Personally, with exception to receiving multiple results from transactions (like insert ids for multiple inserts or querysets for multiple selects), it isn't hard to use MySQL 4.1+'s features (which are the highlight of the mysqli extension) with mysql_ functions. If you want to begin a transaction, you simply query mysql with the transaction BEGIN statement

 

mysql_query('BEGIN', $dbh);

 

and respectively, use the ROLLBACK or COMMIT statements after finishing up.

 

But if you truly require the features of mysqli (multiple results), then go for it. It's there for those who need it!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.