Php 只是尝试显示表中的一行
我收到一条警告消息,告诉我mysql\u fetch\u行需要参数1的资源,我给了它一个对象Php 只是尝试显示表中的一行,php,Php,我收到一条警告消息,告诉我mysql\u fetch\u行需要参数1的资源,我给了它一个对象 <?php $con = new mysqli("localhost", "root", "abc123", "profile"); if (mysqli_connect_errno()) { printf("Connection failed: %s\n", mysqli_connect_error()); exit(); } $sql = "SELECT * FROM mem
<?php
$con = new mysqli("localhost", "root", "abc123", "profile");
if (mysqli_connect_errno()) {
printf("Connection failed: %s\n", mysqli_connect_error());
exit();
}
$sql = "SELECT * FROM members WHERE member_id = 1243433";
$res = mysqli_query($con,$sql);
$row = mysql_fetch_row($res); // error here
print_r($row);
mysqli_close($con);
?>
只需将其更改为mysqli\u fetch\u row
您从mysqli\u
函数系列中为其提供了一个对象,但它是一个mysql\u
函数
基本阅读表明这两种观点是不同的
从同一组函数中使用
mysqli\u fetch\u row
函数。我认为您缺少了一个i
。你的意思是使用mysqli\u fetch\u row
,而不是mysql\u fetch\u row
(没有i)吗?-1:这是一个非常简单的打字错误,你应该能够通过古老的阅读过程发现它。