我有一个表名称为 p_customer,现在我想从表中获取条目数并打印该客户数
<?php
$wherecat3 = "p_customer_status = 'active' AND `p_customer_id` = '".$catRes['p_customer_id']."' ";
$catsql3 = $general->GetRows('*' ,' p_customer' ,$wherecat3);
$catRes3 = mysql_fetch_row($catsql3);
?>
<p><?=$catRes3;?></p>
最佳答案
您可以使用mysqli_num_rows()
来获取从Mysql结果中获取的记录数。
<?php
$wherecat3 = "p_customer_status = 'active' AND `p_customer_id` = '" . $catRes['p_customer_id'] . "' LIMIT $n";
$catsql3 = $general->GetRows('*', ' p_customer', $wherecat3);
$n = mysqli_num_rows($catsql3);
$catRes3 = mysql_fetch_row($catsql3);
?>
<p><?= $catRes3; ?></p>
</div>
关于php - 如何使用 php 从 mysql 中的表中获取多行...,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33255374/