Switch to mysqli or stay with mysql?

We have an application that has been under development (and now in production) for more than a year. Which has a total of over 500 calls mysql_*.

Should I switch everything mysql_* in code tomysqli_*

Is it worth it to chase after all the errors that may (and most likely will) appear?

I see from these questions: Changing this from MySQL to MySQLi? that just adding iafter each call mysql*can lead to a lot of errors. Is my time worth it?

mysql_*will probably be at a long distance (even amid rumors of fatigue), so does it really cost programmers time to switch methodically?

See also discussion.

+5
source share
7 answers

Quoting guides forext/mysqli :

The mysqli extension has several advantages, key improvements over the mysql extension:

  • Object oriented interface
  • Support for prepared statements
  • Multiple Expression Support
  • Transaction support
  • Advanced Debugging Features
  • Embedded Server Support

Note. If you are using MySQL version 4.1.3 or later, it is highly recommended that you use this extension.

If you need only one of these functions and you can afford refactoring, then yes, go for it. If you do not need any of these functions, do not do this. There is no reason for reorganization if there are no advantages.

. ext/mysql , , ( , . , 5.4, , , pecl ). - ext/mysql, .

. http://blog.ulf-wendel.de/2012/php-mysql-why-to-upgrade-extmysql/

+4

, MySQLi , - . , , , , , , , .

OO- , PDO, MySQLi.

2013

, 2011 , mysql_query() mysqli_query() . , mysql_*() PHP 5.5 .

+4

MySQLi MySQL. MySQLi MySQL. .

mysqli_*. , , mysqli . , .

+1

ext/mysql - .

.

, naked API- - SQL-.

, ​​ , , .

,

$res=mysql_query("SELECT STUFF");
while($row = mysql_fetch){
    $var=$row['col'];
}

?
- -,

$data = $db->getRow("SELECT stuff");

, , , , ..

, , , API, .

+1

, mysql_ * . . , mysql_* mysqli_*, .

0

, ( ) .

() , mysqli , mysql_real_escape_string .. .

0

: , mysqli, PDO. mysqli, , PHP5 OO. mysqli OO mysql mysql PDO , .

0

All Articles