-1

Is it usefull to convert all my PHP codes from mysql to mysqli? I mean will mysql be deleted? And is there a tool that converts my codes to mysqli? Or do I just have to change all i.e. mysql_query to mysqli_query?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Lithilion
  • 1,097
  • 2
  • 11
  • 26
  • Changing `mysql_query` to `mysqli_query` is a start, but you should really switch to [prepared statements](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php). – gen_Eric Oct 14 '13 at 19:19

1 Answers1

3

Is it useful?

Yes, read Why shouldn't I use mysql_* functions in PHP? So if you plan on running your code in years to come, you should consider it.

Is there a tool?

This tool if often mentioned but I have never tried it and I think you would learn more by doing it manually. It also seems more complicated than doing it by hand if you're a beginner.

Changing all your mysql_query() function calls to mysqli_query() is not enough. The mysqli_query function requires that you pass a link identifier as the first argument wheareas with mysql_query "If the link identifier is not specified, the last link opened by mysql_connect() is assumed."

And of course it's not just the mysql_query calls you would have to change, but all mysql_* calls.

Community
  • 1
  • 1
Sébastien
  • 11,860
  • 11
  • 58
  • 78