コードに問題があります。同じ値を繰り返す mysql_fetch_array 出力。これは私のコードです:
$sql= "SELECT client.resID AS resID, client.resName AS resName, menu.id AS mid, menu.name AS mname, facilities.name AS fname, facilities.id AS fid FROM client INNER JOIN menu ON client.resID = menu.resID INNER JOIN facilities ON client.resID = facilities.resID WHERE client.resID =".$_GET["resID"];
$rs = mysql_query($sql) or die($sql."<br/><br/>".mysql_error());
while ($f = mysql_fetch_array($rs)) { // loop as long as there are more results
$names[] = $f['mname']; // push to the array
print_r($names)
}
レストランに米とじゃがいもがあるとしましょう。print_r($names) が返されます:
Array ( [0] => rice [1] => potato [2] => rice [3] => potato [4] => rice [5] => potato [6] => rice [7] => potato [8] => rice [9] => potato )
どうすればこの問題を解決できますか? あなたの助けに本当に感謝します:D