查询只返回一个值在php和mysql中

时间:2018-08-17 16:51:51

标签: php mysql

嗨,伙计们,我只查询了12行,即使我有12行。请帮助

$connection = mysqli_connect("localhost","root","","database");
$qry="SELECT COUNT(*) as count FROM table";
$result=mysqli_query($connection, $qry);

1 个答案:

答案 0 :(得分:-2)

正如Devon所述,COUNT是一个聚合函数,因此它将仅返回1行。如果要检索所有12行,请执行以下操作:

SELECT * FROM table;