この投稿は、lazygc520 によって最終編集されました (2013-06-07 09:37:32)
<br />
<?php<br />
$sql = "select DISTINCT b.packageno,a.stock_no from `stock_detail` as a,`kw_manage` as b where a.stock_no = '".$stockno."' and a.cust_no = replace( b.cust_no, ' ', '' )";<br />
$result = mysql_query($sql);<br />
while($row = mysql_fetch_array($result,MYSQL_ASSOC))<br />
{<br />
$sql2 = "select lotno,count(lotno) from `vp_barcode_2d_y` where packageno = '".$row['packageno']."' group by lotno order by lotno asc";<br />
$result2 = mysql_query($sql2);<br />
$var = array();<br />
while($row2 = mysql_fetch_array($result2,MYSQL_NUM))<br />
{<br />
<br />
$var[] = array('lotno'=>$row2[0],'count'=>$row2[1]);<br />
}<br />
print_r($var);<br />
}<br />
<br />
// echo $a[$k]['5'].'<br />';<br />
?><br />
得られた結果:
配列<br>
(<br>
[0] => 配列<br>
(<br>
[lotno] =>
[カウント] = & GT; <br>
)<br>
<br>
)<br>
配列<br>
(<br>
[0] => 配列<br>
(<br>
[lotno] =>
[カウント] = & GT; <br>
)<br>
<br>
)<br>
配列<br>
(<br>
[0] => 配列<br>
(<br>
[lotno] =>
以来
)<br>
<br>
[1] => 配列<br>
(<br>
[lotno] =>
[カウント] = & GT; <br>
)<br>
<br>
)<br>
配列<br>
(<br>
[0] => 配列<br>
(<br>
[lotno] =>
[カウント] = & GT; <br>
)<br>
<br>
)<br>
配列<br>
(<br>
[0] => 配列<br>
(<br>
[lotno] =>
[カウント] = & GT; <br>
)<br>
<br>
)<br>
配列<br>
(<br>
[0] => 配列<br>
(<br>
[lotno] =>
[カウント] = & gt; 15 <br>
)<br>
<br>
)<br>
配列<br>
(<br>
[0] => 配列 <br><br>