PDO UPDATE too long to execute
PDO UPDATE too long to execute
(OP)
i need HELP ! please, about this update PDO which works but takes too long to execute (almost 10 seconds)
// the following $_POST receives 365 values from 365 inputs of the form
$k = $_POST['k'];
// here i am updating all 365 values of column1 of my table
$sql = "UPDATE myTable SET column2=: column2 WHERE id=:id";
$stmt = $conn->prepare($sql);
for ($i = 1; $i <= 365; $i++) {
$id[$i] = $i;
$n = $i-1;
$stmt->bindParam(': column2', $k[$n], PDO::PARAM_STR);
$stmt->bindParam(':id', $id[$i], PDO::PARAM_INT);
$stmt->execute();
}
// the following $_POST receives 365 values from 365 inputs of the form
$k = $_POST['k'];
// here i am updating all 365 values of column1 of my table
$sql = "UPDATE myTable SET column2=: column2 WHERE id=:id";
$stmt = $conn->prepare($sql);
for ($i = 1; $i <= 365; $i++) {
$id[$i] = $i;
$n = $i-1;
$stmt->bindParam(': column2', $k[$n], PDO::PARAM_STR);
$stmt->bindParam(':id', $id[$i], PDO::PARAM_INT);
$stmt->execute();
}
RE: PDO UPDATE too long to execute
https://www.tek-tips.com/threadminder.cfm?pid=434