我发现我的脚本花费的时间比我预期的要长得多。他们一遍又一遍地超时。我不认为我的脚本(如下所示)是无穷无尽的。
// Post Variables from form to script
$a = 49; // variables start at w49 and go to w62
while ($a<=62) {
$bclass = 'b'.$a; // my naming convention for posted data
$wclass = 'w'.$a; // my database's naming convention
if (!empty($_POST[$wclass])) {
${$bclass} = $_POST[$wclass]; // post if not empty.
}
$a++; // cycle to next
}
// Handle certain forms, described by level
if ($level === '1') {
$x = 49;
$query = "UPDATE users SET "; // beginning of query
while ($x <= 56) {
$bclass = 'b'.$x;
$wclass = 'w'.$x;
$j = 'A';
if (!empty(${$bclass})) {
if ($j = 'A') {
$query = $query."$wclass = '${$bclass}'";
} else {
$query = $query.", $wclass = '${$bclass}'";
}
$j++;
} else {}
}
$query = $query." WHERE email = '$email' LIMIT 1"; // end of query
$result = mysqli_query($conn, $query);
}
答案 0 :(得分:3)
while ($x <= 56...
$x
何时递增?会不会达到56?