Page 1 of 1

MySQL connectivity, what should I be using?

Posted: Thu Mar 06, 2014 11:42 pm
by iCoolUserName
Hey there,

So I'm in the middle of designing my first "website" in the sense that I'm a noob with PHP/MySQL, I've never used them before and as such have taken it upon myself to learn them, thankfully some of my previous programming skills are semi-transferable as I feel more or less "up to speed" with PHP. Earlier I had a slight issue where I couldn't format the output from a mysql query correctly and so hit google to find a solution, I didn't (I figured it out anyway), I found more questions than I did answers :banghead: .

As such my questions are as followed:
What is the current method of connecting/performing computations on a MySQL DB? I've been using MySQL_*, but it appears MySQLi_* would be more efficient.

The php.net website further indicates that mysql_* is deprecated and the way to go is some mystical mumbo jumbo called PDO (PHP Data Objects), is this; A) Correct & B) Future proof?

Besides this: http://uk1.php.net/manual/en/book.pdo.php
Can you recommend an good resources/tutorials geared at/containing PDO?

Thanks.

PS:The mystical bit was a joke, it was funny, ha-ha

Re: MySQL connectivity, what should I be using?

Posted: Fri Mar 07, 2014 8:55 am
by Celauran
MySQLi does indeed replace the deprecated MySQL driver but I find it to be cumbersome to use. PDO is definitely the way to do and is what many ORMs use under the hood. The book you linked is as good a place as any to start. The basic principles are the same, so migrating from mysql_ to PDO should be reasonably painless.

Re: MySQL connectivity, what should I be using?

Posted: Fri Mar 07, 2014 1:56 pm
by iCoolUserName
Thank you,
the speed at which web technologies move is irksome. I've been using a book that's not even 2 years old and it's out dated.