我绑定update
了一定数量的记录,在我的代码中$tickets
= 10,这意味着我只需要根据 mysql 标准更新数据库中的 10 条记录,我的for loop
这里更新所有记录(一次 100 条记录!)为我的标准,这是我的代码
for ($counter = 1; $counter <= $tickets; $counter++) {
$bookTicket = mysql_query("UPDATE units SET
ticketSold = 'No',
userIdFK = '$chooseUser'
WHERE BusinessreservationIdFk = '$eventId'
AND classIDfk ='$chooseClass' ")
or die(mysql_error());
if ($bookTicket)
{
echo "<br/>ticket " . $counter . " done !";
}
else
{
echo "no<br/>";
}
}
每次for
计数时如何更新一条记录?