Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PDO UPDATE too long to execute

Status
Not open for further replies.

Bill Doe

Technical User
May 10, 2022
1
0
0
FR
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();
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top