问题
who can help me turn this code into mysqli? Ho tentato più soluzioni ma nn riesco a trasformarlo. THX
function GetFilesById($Id){
$query = "SELECT * FROM allegati where id=$Id";
$result = mysql_query($query);
$data = MYSQL_RESULT($result,0,"data");
$type = MYSQL_RESULT($result,0,"filetype");
$name = MYSQL_RESULT($result,0,"filename");
$myFile = array("data" => $data,
"type" => $type,
"name" => $name,
);
return $myFile;
}
回答1:
Define DB connection variable like: $conn = new mysqli($servername, $username, $password);
Now instead of calling --- $result = mysql_query($query);
Just call --- $result = mysqli_query($conn, $query);
来源:https://stackoverflow.com/questions/61054748/mysql-to-mysqli-change