Why ismysqli_ better thanmysql_?

Asked

Viewed 179 times

2

I would like to know what are the advantages mysqli_ has in relation to mysql_, because they keep suggesting me to pass to mysqli_.

  • The first reason is simple and obvious. php_mysqli is the enhanced version of php_mysql. The php_mysql library has been obsolete since version 5.5. The recommendation for change has been widely publicized for over 6 years.

  • 3

    It’s hard to deal with duplicates these days. The person asks without researching, people answer without researching, then the AP soon accepts some, even if there is no quality already found on the site, before they close.

  • see a code using mysql_ormysqli_ is at least nostalgic for me.

  • @bigown by chance I researched quite a lot until, but I did not find this question.

3 answers

3


Function MySQL are therefore impaired functions MySQLi end up being newer, safer, have new features (features) and are object-oriented. Aside from that MySQLi is an evolution of MySQL.

There is still an alternative to MySQLi which is the PDO (driver that implements the PHP Data Objects interface) that allows working with multiple databases transparently.

  • 1

    I prefer PDO ^_^

  • 1

    @Wallacemaxters Also =D

3

I don’t think you have any idea what it is mysqli_ and mysql_. These are not different DBMS. They are libraries (extensions) of access to a Mysql database through PHP. The difference is that functions of type mysql_ will be discontinued and the improved mysqli_ to replace.

  • Although it seems obvious, I fully agree with your explanation of "they are not DBMS". For those who are starting, this may actually seem confusing :\

  • @Wallacemaxters if you look at the original question you realize it looks like AP thinks they’re DBMS.

  • 1

    @Wallace, the original title, and the context, like the tags, did not include PHP. I also think AP might be confusing it with SGDB. In the first edition I made explicit as php_mysql and php_mysqli, however, someone removed and leftmysql_ and mysqli_..

  • It was me @Danielomnie didn’t get better like this?

1

By title placing in the manual on the library mysqli, I answer very simply:

Whymysqli_ is better than mysql_?

Because according to the manual, it’s:

Improved Mysql extension

Look at this one link

Other words: the extension Mysqli is the evolution of the Mysql for PHP.

In case, I advise you to leave your codes with mysqli, since the extension mysql has already been discontinued (and its use becomes discouraged by PHP staff).

  • And Mariadb is the same thing as Mysqli ?

  • No, it’s another SGDB. It’s like the difference of Postgresql, Mysql, Sqlserver, Sqlite and the like :)

  • 1

    Rodrigo... mysql and mysqli to which you refer are only PHP libraries for connection to SGDB Mysql..

  • When I said "it’s another SGDB" I didn’t mean that Mysqli was an SGDB, but "Maria DB"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.