i want to update the databse by using this code
$personnel_sql = "UPDATE user_detail SET qualification='$qualification', community='$community', pwd='$pwd', gender='$gender', nationality='$nation', religion='$relegion', ex_serviceman='$ex_service', date_joining='$doj', date_of_retirement='$dor', service_field='$serving_area', j&k_factor='$jkfactor', body_mark='$mark_body', aadhar_no='$aadhar_no' WHERE username='$user'";
// echo $personnel_sql;
if ($conn->query($personnel_sql) === TRUE) {
// echo "Record updated successfully";
$message = 'Your basic data is successfully updated.';
echo $message;
// echo "<SCRIPT type='text/javascript'>
// alert('$message');
// window.location.replace(\"index.php?get=update/&&username=$user\");
// </SCRIPT>";
} else {
echo "Error updating record: " . $conn->error;
}
and i got this error again and agai why
Error updating record: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '&k_factor='No', body_mark='dharmendra', aadhar_no='2147483647' WHERE username='D' at line 1
what is the reason of this error
after doing this
echo $personnel_sql;
it gives me this data
UPDATE user_detail SET qualification='10', community='OBC', pwd='Speak Problem, Both ear hearing problem, Left ear hearing problem , right ear hearing problem, There is no hands, Paralised both hands, Only Left hand, Paralised lrft hand, Less finger in left hand, Only Right Hand, Less finger in right hand, No legs, ', gender='MALE', nationality='INDIA', religion='HINDU', ex_serviceman='', date_joining='Apr 16, 2019', date_of_retirement='Apr 23, 2019', service_field='Army', j&k_factor='No', body_mark='dharmendra', aadhar_no='2147483647' WHERE username='Dharmendra_Soni_1554114509'