我想将此功能从mysql更改为mysqli

时间:2019-04-09 22:51:17

标签: php mysql mysqli

大家好,我想将此功能从mysql更改为mysqli

function GetRecordByID($table,$id){
    $id  = intval($id);

    $query = "SELECT * FROM settings WHERE ID = '$id'";
     if (!$sql = mysql_query($query)) {
        echo "Error: Can not excute the query. <br>".$query;
    } else {
        $num = mysql_num_rows($sql);
        while ($num > 0) {
            $data = mysql_fetch_array($sql);
            $num--;
        }
    }
    return $data;
}

0 个答案:

没有答案