How to change mysql to mysqli?

前端 未结 11 1950
余生分开走
余生分开走 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:47

    (I realise this is old, but it still comes up...)

    If you do replace mysql_* with mysqli_* then bear in mind that a whole load of mysqli_* functions need the database link to be passed.

    E.g.:

    mysql_query($query)
    

    becomes

    mysqli_query($link, $query)
    

    I.e., lots of checking required.

提交回复
热议问题