当我在 phpMyAdmin 中运行此查询时,它会加载所有行。但是当我通过 PHP SQL 运行它时,我只得到第一行。我不确定我在这里做错了什么,我真的很紧张。
这是我的代码:
function getRows($user)
{
$q = mysql_query("SELECT day(closed) AS day, COUNT( closed ) AS c FROM ost_ticket WHERE year(closed) = '2013' AND monthname(closed) = 'January' AND source = '{$user}' GROUP BY day LIMIT 30");
$count = mysql_num_rows($q);
return $count;
}
function test11($user)
{
$q = mysql_query("SELECT * FROM ost_ticket WHERE closed LIKE '%2013-06- 19%' AND source = '" . $user. "'");
if(!$q)
{
echo mysql_error();
}
$r = 0;
$a = mysql_num_rows($q);
echo $a;
while($row = mysql_fetch_assoc($q))
{
return $row['status'];
return $row['day'];
$r++;
}
}
function getUser()
{
$q = mysql_query("SELECT * FROM ost_staff WHERE staff_id > 2");
while($row = mysql_fetch_assoc($q))
{
$count1 = getRows($row['username']);
$a = 0;
echo '<div id="' . $row['username'] . '" class="stat">
<span class="title">' . $row['username'] . '</span><br /><br />
<div id="break"></div>';
echo '
<div id="data-' . $row['username'] .'">' . test11($row['username']) . '</div>';
echo '</div>';
}
}
Thanks in advance for this.