MySQL將我的結果加倍?MySQL選擇打印兩條記錄兩次?
mysql_select_db("db", $con);
$result = mysql_query("SELECT * FROM cart_products WHERE cart_id=22");
while($row = mysql_fetch_array($result))
{
print("'.$row['name'].'<br/>");
}
mysql_close($con);
我的數據庫:
cart_id name
22 john
22 sarah
我打印HTML:中
john<br />sarah<br />
john<br />sarah<br />
代替
john<br />sarah
爲什麼它打印四條記錄?
當您運行SELECT * FROM cart_products WHERE cart_id = 22時會得到什麼結果? –