Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2005
    Thanked 0 Times in 0 Posts

    mysqli_ ..type functions ??

    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

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Saskatoon, Saskatchewan
    Thanked 2,662 Times in 2,631 Posts
    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!
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Philadelphia, PA, USA
    Thanked 258 Times in 254 Posts
    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.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts