When I try to edit the database, I get this error:
SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
There are questions related to this error, but they don't seem to apply to this case. Thanks!!
<php
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);
require_once 'db.php';
if(isset($_POST['submit']))
{
$get_id=$_REQUEST['id'];
$name=$_POST['name'];
$surname=$_POST['surname'];
$pic = $_FILES['pic']['name'];
try{
move_uploaded_file($pic,"uploads/$pic");
$stmt = $db_con->prepare("UPDATE posts SET
name=:name,surname=:surname,pic=:pic WHERE id=:GET_id");
$stmt->bindParam(":id", $id);
$stmt->bindParam(":name", $name);
$stmt->bindParam(":surname", $surname);
$stmt->bindParam(":pic", $pic);
if($pic=="") {
move_uploaded_file($pic,"uploads/$pic");
("UPDATE posts SET name=:name, surname=:surname, pic=:pic WHERE id=:GET_id");
$stmt->bindParam(":id", $id);
$stmt->bindParam(":name", $name);
$stmt->bindParam(":surname", $surname);
$stmt->bindParam(":pic", $pic);
}
if($stmt->execute())
{
echo "<script>alert('Successfully Updated!!!'); window.location='index.php'</script>";
}
else{
echo "Query Problem";
}
}
catch(PDOException $e){
echo $e->getMessage();
}
}
?>