文字列を使用して配列を印刷し、配列を$key
使用$value
して印刷すると、値をforeach ($array key => value)
含むキーnull
が表示されません。誰かがこれで私を助けてくれますか?
$stockist = array();
while($row = mysql_fetch_array($result)) {
$pharmacy = trim($row['pharmacy']);
if (isset($stockist[$pharmacy])) {
$medicine = $stockist[$pharmacy];
$medicine[] = trim($row['pharmacy']);
$stockist[$pharmacy] = $medicine;
}
else {
$medicine = array();
$medicine[] = trim($row['medicine']);
$stockist[$pharmacy] = $medicine;
}
}
ksort($stockist);
foreach ($stockist as $key => $value) {
echo "<table align='center' border='1'>";
echo "<tr><td align = 'justify'> <font color = 'blue'> $key</td></tr>";
foreach ($value as $key1 => $value1) {
echo "<tr><td align ='justify'>$value1</td></tr><br>";
}
echo "</table>";
}