Hello
am new in php and am having error with my code. i want to update my database fron my form but when i run my script it has the following error. Please help out thank you in advance.
<html>
<head>
<title></title>
</head>
<body>
<?php
/*
Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password)
*/
$link = mysqli_connect("localhost", "root", "", "muthala primary");
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
// Escape user inputs for security
$first_name = mysqli_real_escape_string($link, $_POST['firstname']);
$last_name = mysqli_real_escape_string($link, $_POST['lastname']);
// attempt insert query execution
$sql = "INSERT INTO students (first_name, last_name,) VALUES ('$first_name', '$last_name',)";
if(mysqli_query($link, $sql)){
echo "Records added successfully.";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
// close connection
mysqli_close($link);
?>
</body>
</html>