$schoolinfo = mysqli_prepare($con, "UPDATE table SET firstname=?, lastname=? from school where foreignkey='$id'");
mysqli_stmt_bind_param($schoolinfo,'ss', $firstname, $lastname)
for ($i=0;$i<count($_POST['row']);$i++){
$firstname = mysqli_real_escape_string($con, $_POST['firstname'][$i]);
$lastname = mysqli_real_escape_string($con, $_POST['lastname'][$i]);
mysqli_stmt_execute($schoolinfo);
}
This updates all rows with the same firstname and lastname.
I want to update rows from selection where foreignkey = '$id' and rownumber ='i'
Any queries or subqueries out there?
mysqli_real_escape_stringwhen usingbind_param. You'll end up escaping twice.rownumberin your query.