Heim > Fragen und Antworten > Hauptteil
$connect = mysqli_connect("host","user","password","db") or die("Error " . mysqli_error($connect));
$result = mysql_query('select * from admin',$connnet);
print(mysql_num_rows($result));
mysql_close();
报错:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
Warning: mysql_close(): no MySQL-Link resource supplied
而使用面向对象方法则没有问题
请问这是什么问题?
PHPz2017-04-11 09:45:10
因为你写错字母了...
第一个变量是 $connect
第二个变量是 $connnect
多了一个n,好不?
当然,也要用mysqli_query而不是mysql_query
迷茫2017-04-11 09:45:10
mysql_query -> mysqli_query
mysql_num_rows -> mysqli_num_rows
mysql_close -> mysqli_close