How to do mysql_fetch_assoc in mysqli?

后端 未结 2 1189
一向
一向 2020-12-20 18:43

How can I do the following in mysqli prepare statement?

$result = mysql_query($sql);
$data = mysql_fetch_assoc($result);
return $data:
2条回答
  •  再見小時候
    2020-12-20 19:07

    You need to use the MySQLi version of the functions:

    $result = mysqli_query($sql);
    $data = mysqli_fetch_assoc($result);
    return $data;
    

    That should do it, you also might want to take a look at:

    • http://php.net/mysqli
    • http://www.php.net/manual/en/class.mysqli-result.php

提交回复
热议问题