问题是你有一个代码从数据库获取变量,然后当你检查一个值,如果它在那里你设置的东西然后你回到数据库,到代码中的特定点重新获得更多的值如果那些你不能工作的人。例如,吼叫。
<?php
a;
$sql2 = "SELECT * FROM `mytable` WHERE Available = 1 ORDER BY edate ASC LIMIT 1";
$rs2 = mysqli_query($conn, $sql2) or die ('error :'.$sql2);
$sr2 = mysqli_affected_rows($conn);
while($row2=mysqli_fetch_array($rs2)) {
$Num = $row2['myID'];
$Dcount = $row2['count'];
$DEdate = $row2['edate'];
if ($Dcount <= $avail){
$avail = abs($Dcount - $avail);
$sqlUp = "UPDATE mytable Set Available = 0, count = 0 WHERE myID = '$Num'";
if (!mysqli_query($conn, $sqlUp)) {
die('Error Records Saving Failed! : ' . mysqli_error($conn);
else{
GO TO a;
}
}else{
$sqlUp = "UPDATE mytable Set count = 0 WHERE myID = '$Num'";
if (!mysqli_query($conn, $sqlUp)) {
die('Error Records Saving Failed! : ' . mysqli_error($conn);
}
?>
&#13;
是可行的还是有另一种方式。