I have the following table in mysql. I need to select the Hid(s) from this table and append the results to a string '$s'. It would be great if you could help.
Table name : CASES
Did Hid Year Case
--- --- ---- ----
1 1 2011 6
1 1 2012 7
2 2 2011 40
2 2 2012 10
php code segment:
$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
}
$s.= $rw["Hid"];which is shorthand for$s = $s.$rw["Hid"];