我在mysql中有下表。我需要从此表中选择 Hid(s) 并将结果附加到字符串“$s”。如果您能提供帮助,那就太好了。
表名:案例
Did Hid Year Case
--- --- ---- ----
1 1 2011 6
1 1 2012 7
2 2 2011 40
2 2 2012 10
php代码段:
$did=1;
$yr=2011;
$s='';
$q="select Hid from CASES where Did=$did and Year=$yr and Case!=0 ";
$r=mysql_query($q);
while($rw=mysql_fetch_assoc($r))
{
//I need to append the Hid(s) to a String '$s' declared above
}