我正在尝试将 mysql_result 转换为 mysqli。没有同等的转换。
$total_items = mysql_result(mysql_query($con,' SELECT FOUND_ROWS(); '), 0, 0);
$this->items = $data;
最佳答案
已弃用的mysql_result
等于新的mysqli命令mysqli_fetch_field
。您可以在 php.net 文档中找到示例。例如非面向对象:
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";
if ($result = mysqli_query($link, $query)) {
/* Get field information for all fields */
while ($finfo = mysqli_fetch_field($result)) {
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n\n", $finfo->type);
}
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
关于mysql - 在 mysqli 中转换 mysql_result,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34521268/