Jump to content

MYSQLI vs MYSQL and InnoDB vs MyISAM


s0c0

Recommended Posts

Which should i use for performing mysql queries etc... via php mysql or the newer mysqli connector.  The book I'm reading tells me to use mysqli, but I read otherwise on the web.  The book is PHP and MySQL web devevlopment by Luke Welling and Laura Thomson.

Also is InnoDB better than MyISAM.  I know MyISAM can't do fk-pk relations, so what is it good for?
Link to comment
Share on other sites

[quote]
If you dont know what pdo is, its one interface that can connect to a whole range of database not just mysql.
[/quote]

I believe pdo is available only on >= PHP5.  Adodb is another db abstraction layer that allows for generic data soruces and will run on PHP4 (http://adodb.sourceforge.net/).

Best,

Patrick
Link to comment
Share on other sites

PDO is more for abstraction. If you're only using MySQL and plan on only using MySQL, then use mysql_ or mysqli_ functions. PDO will just slow your scripts down.

If you're making new code from scratch and you know that you're always going to have PHP 5.0+ and MySQL 4.1+ on your webserver, use mysqli.

mysqli is really some amazing stuff, once you get in to it.

http://devzone.zend.com/node/view/id/686
http://devzone.zend.com/node/view/id/687

Edit:
I saw that you mentioned you read this from a book. If you're just starting PHP, you might want to learn the more widely used mysql_ functions first, since about 95% of the PHP/MySQL scripts use them, and they are simple.
Link to comment
Share on other sites

[quote author=s0c0 link=topic=124838.msg517858#msg517858 date=1170229416]
Also is InnoDB better than MyISAM.  I know MyISAM can't do fk-pk relations, so what is it good for?
[/quote]

See [url=http://www.phpfreaks.com/forums/index.php/topic,112949.0.html]this[/url] topic.
Link to comment
Share on other sites

  • 2 weeks later...

PDO is more for abstraction. If you're only using MySQL and plan on only using MySQL, then use mysql_ or mysqli_ functions. PDO will just slow your scripts down.

 

PDO is not an abstraction layer it is merely an interface for all the popular databases, it is also unfair to compare something so general as pdo to a driver designed specifically for MYSQL in terms of features and speed. and there are reasons I think learning any mysql extension is a bad idea. It is better to learn one DB API as opposed to one for postgres, one for mysql, another for mssql, and one more for oracle.

 

Link to comment
Share on other sites

Innodb is basically for huge sites/db's that has to perform thousand queries per second and needs to handle gigs of data. It also supports transactions and table locking. So in short, For the biggies.

 

While MyIsam is suitable for all the avarage stuffs. So you choose.

Link to comment
Share on other sites

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.