|
-
Nov 27th, 2009, 11:12 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] mysql -> mysqli
Being a bit lazy, and absent from php a while (rusted) I downloaded and implemented this php database class. Works sweet.
However, this oke use mysql in the class, and I considered changing to mysqli
MySQLi is an improved database layer for PHP 5 and MySQL 4.1+. It is strongly recommended that MySQLi be used if your MySQL server is at version 4.1 or higher !
Just wonder, would it work if I swap out all the mysql calls with their mysqli equivalents?
I remember vaguely (or imagining myself) that's not the case, and guess I need to do some research. Just have limited time, so figured drop a Q here.
mysql_connect
mysql_select_db
mysql_query
mysql_num_rows
mysql_fetch_row
mysql_data_seek
mysql_insert_id
mysql_close
-
Nov 27th, 2009, 04:20 PM
#2
Re: mysql -> mysqli
umm. for the most part, you might be able to do that. you may want to just use MySQLi's own OO interface instead, though?
MySQLi opens up prepared statements and allows you to bring object oriented programming to your database interface itself. however, when looking into switching from the MySQL extension to either MySQLi or PDO, I picked PDO. My reasons were mostly based on the fact that, while both extensions are similar, PDO supports multiple database types -- and MySQLi was obviously built for just MySQL. while I don't see myself using anything other than MySQL for web applications in the foreseen future, I thought it could end up being better in the long run.
however, using MySQLi with PHP can be a nice thing. for example, PDO doesn't have a "num_rows" equivalent; the MySQL and MySQLi extensions do. there are, of course, workarounds for that though.
this is a pretty nice article on MySQLi.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|