Question

Why when I update a record it does it but creates about 15 duplicate records in the table? My code is below. Any help would be great

<?php
$con=mysqli_connect("127.0.0.1","root","","assignment2");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$module_id=$_POST['module_id']; 
$user_id=$_POST['user_id']; 
$grade=$_POST['grade']; 


mysqli_query($con,"UPDATE grades SET module_id='$module_id', user_id='$user_id',
grade='$grade' WHERE module_id='$module_id'");              
mysqli_close($con);
echo "Student successfully updated!"

?>

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top