How to upgrade from mysql_* to mysqli_*?

前端 未结 2 1059
Happy的楠姐
Happy的楠姐 2020-12-19 10:07

I\'m currently using deprecated code to get data from users, as follows:

/* retrieve */
$lastName = $_POST[\'lastName\']; 
$firstName = $_POST[\'firstName\']         


        
2条回答
  •  暖寄归人
    2020-12-19 10:58

    see this pages for converting mysql into mysqli

    Converting_to_MySQLi

    https://wikis.oracle.com/display/mysql/Converting+to+MySQLi

    and see mysqli_real_escape_string manual that explain about mysqli_real_escape_string and Security problem and how to solve it.

    php.net:

    Security: the default character set

    The character set must be set either at the server level, or with the API function mysqli_set_charset() for it to affect mysqli_real_escape_string(). See the concepts section on character sets for more information.

    see this page for query for insert data

    see this page for prepare data for inserting to mysql

    and http://php.net/manual/de/mysqli.quickstart.prepared-statements.php

提交回复
热议问题