当我打印带有字符串 as$key
和数组 as $value
using的数组时,不显示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>";
}