Mysql to mysqli or PDO

please my website still use the mysql command , i will like to update to mysqli , what article can i read(someone once pointed me to it , but i can find it)

please my website still use the mysql command ,
i will like to change to PDO (i will say am like a beginner , but want to put in more effort in my programming), please what article can i read to help me. or what should i do

It’s easy if you know the commands.

I recommend having an editor that is easy to use. Don’t use NotePad because it’s just plain bad for editing anything. If your original files had entered line breaks, NotePad will just reformat the entire document and basically put every single line you had into 1 huge freakn line.
I’d recommend using NotePad++ or Dreamweaver or something that works great.

After you have done that, replace your old database connect with the new one. Then using the default replace on the text editor, replace every single myql_ functions with the new mysqli function you have chosen.

Be aware, you CANNOT mix match the old MySQL functions with MySQLi functions. You can however use both $mysqli-> and mysqli_
Comment me if I missed something or have said something wrong.


Have you decided on one or the other?

I wrote a Sticky on my experience with changing from mysql_ to procedural mysqli_ that might help
[COLOR=“Red”][B]STOP[/B][/COLOR] using [b]mysql[/b] - migrating to procedural mysqli !!
It doesn’t cover everything, but it should give you enough to get started.
If you have any particlar problems, just ask.

hello, i want to go for the PDO, because different people and say its better and more dynamic, and mysqli is just a fix that will need further fix

IMHO and many others, PDO is the better choice.

A problem for you might be that it is OOP.

If you are comfortable with OOP or are willing to get into it, then yes, I think you should go to PDO while you’re re-writing your code.
These might be of some help

But if you are not ready for OOP, mysqli_ does allow procedural coding, potential problem being it’s for MySQL and will likely break if you change database engines.

thanks, i am not comfortable but willing to learn to make me better, just got another system(iMac 10.maverick 10.9) and trying to install apache,php d of ysql(the other two are straight forward) but i am following this article

but kind of got stuck in the “Create a Sites folder at the account root level”

when i run the
cd /etc/apache2/users
sudo nano username.conf

it opens up the nano editor

and i am thinking from this article i am to create my username, by swapping the username in the below command line

<Directory “/Users/username/Sites/”>
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all

but after which i press enter it only goes to the next , i use text wrangler normally , please any clue on what to do next.


i have sorted it, i did not realise ctl x was for save on terminal. thanks

Id say PDO, it encourages you to use OO techniques so your skills can be improved to another level. MySQLi has procedural style available, for beginners it’s easier to get used to but it’s also a hindrance if you do not take this chance to move from procedural to OO programming.