I cannot use mysql_* functions after upgrading PHP

后端 未结 1 1199
自闭症患者
自闭症患者 2020-11-28 00:04

I am having few problems with the PHP upgrade. Before, I was using PHP 5.2.0 and below; now I have upgraded to PHP 5.5.0. A few of my snippets are not running as I expected.

相关标签:
1条回答
  • 2020-11-28 00:45

    mysqli_real_escape_string needs two arguments to work:

    Syntax:

    mysqli_real_escape_string($connection,$escapestring);
    

    You need to give it the connection variable. This looks like

    $connection=mysqli_connect("host","my_user","my_password","my_db");
    

    You should refresh your PHP knowledge.

    An alternative method would be to use a database object so you don’t have to pass in the connection details each time.

    0 讨论(0)
提交回复
热议问题