How to change mysql to mysqli?

前端 未结 11 1905
余生分开走
余生分开走 2020-11-21 04:55

Based on this code below I use for regular mysql, how could I convert it to use mysqli?

Is it as simple as changing mysql_query($sql); to

11条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-21 05:26

    The easiest way i always handle this Where

     $con = mysqli_connect($serverName,$dbusername,$dbpassword);
    

    3 steps replacement in the following order

    1. All "mysql_select_db(" with "mysqli_select_db($con,"
    2. All "mysql_query(" with "mysqli_query($con," and
    3. All "mysql_" with "mysqli_".

    This works for me everytime

提交回复
热议问题