私はmysqlに次のテーブルを持っています。このテーブルから Hid を選択し、結果を文字列 '$s' に追加する必要があります。お役に立てれば幸いです。
テーブル名:CASES
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
}