View Full Version : mysqli_ ..type functions ??

08-30-2007, 08:09 AM
Hello forums!!
I am eagerous to know the use of mysqli_ like functions for mysql operations.
1> whats the difference between mysql_ and mysqli_ type functions ?
2> which one to use and why ?
3> in some code i found a complex queries operations like
functions found basically in OO approach, whats its advance over general mysqli_query(),mysqli_fetch_array() ?
4> which type of function is suitable for mysql operations in php5 in relative to performance ?

Can anybody clearify about the facts mentioned above ? It would really greatful for me if i know the answer.

Thanks in advance to all of you

08-31-2007, 01:10 AM
If I'm not mistaken, MySQLi functions are based around an object while the standard MySQL functions are based around procedure calls. Someone may be able to confirm that for certain.
In either case:
1. There are not a lot of differences in and of themselves between the MySQL and MySQLi methods.
2. If your MySQL client version is < 5, use MySQL, if its > 5, you may need to use MySQLi. The mysql switched their password encryption algorithms - I'm not certain if its exactly at version 5, or one of the late 4.x builds. In either case, unless passwords are stored as OLD_PASSWORDS (if that flag is correct, either way you know what I'm talking about), you need MySQLi to run with a MySQL 5.x version.
3. Its been awhile so bare with me here:
->prepare() prepares a SQL call
->stmt_bind_param() binds a given value to a parameter variable within the prepare() call
->execute() executes the SQL command
->stmt_bind_result() binds the result resource to a variable for use with fetch() if I'm not mistaken.
Notice that these are methods of an object, but mysqli also has procedural calls.
4. I can't really answer this one for you. It depends on your version of mysql, how it is being used, and whether you are using php and mysql as objects or not. What I can tell you is that I have yet to actually use the mysqli methods in a developed site - even with mysql 5, I find that old passwords are always in use, and as such I can get away with reusing my mysql (based for version 4) class.

Hope that helps, and hope that someone can clarify with more certainty on these answers!

08-31-2007, 12:46 PM
The MySQLi Library stands for "MySQL Improved". As mentioned above it does take an OOP approach, but the main reason for its existence is to work with MySQL v4.1.3 and above, where newer MySQL features are available, such as transactions and prepared statements.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum