这有什么问题?前 2 个选择工作正常,其他 2 个返回此错误:
警告:mysql_fetch_assoc() 期望参数 1 是资源,给定的布尔值
<?php
$result=mysql_query("SELECT count(*) as total from urls WHERE username = '$username' AND approved = 'yes' ");
$data=mysql_fetch_assoc($result);
echo $data['total'];?></td>
<td><?php
$result2=mysql_query("SELECT count(*) as total2 from urls WHERE username = '$username' AND approved = 'no' ");
$data2=mysql_fetch_assoc($result2);
echo $data2['total2'];?></td>
<td><?php
$result3=mysql_query("SELECT count(*) as total3 from buy WHERE username = '$username' AND status = 'active' ");
$data=mysql_fetch_assoc($result3);
echo $data['total3'];?></td>
<td><?php
$result4=mysql_query("SELECT count(*) as total4 from buy WHERE username = '$username' AND status = 'complete' ");
$data=mysql_fetch_assoc($result4);
echo $data['total4'];?></td>