I am testing a form and it gives me that error on line 21 that says:
$stat1 = $db->prepare("insert into about values(?,?,?,?,?)");
The code is like this:
<?php
$host = 'localhost';
$db = 'form';
$user = 'root';
$dbpass = '';
if(isset($_POST['save'])){
$id = uniqid();
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$username = $_POST['username'];
$password = md5($_POST['password']);
$title = $_POST['title'];
$description = $_POST['description'];
$sites = $_POST['sites'];
$category = $_POST['category'];
$stat1 = $db->prepare("insert into about values(?,?,?,?,?)");
$stat1->bindParam(1, $id);
$stat1->bindParam(2, $name);
$stat1->bindParam(3, $email);
$stat1->bindParam(4, $phone);
$stat1->bindParam(5, $address);
$stat1->execute();
$stat2 = $db->prepare("insert into account values(?,?,?)");
$stat2->bindParam(1, $id);
$stat2->bindParam(2, $username);
$stat2->bindParam(3, $password);
$stat2->execute();
$stat3 = $db->prepare("insert into website values(?,?,?,?,?)");
$stat3->bindParam(1, $id);
$stat3->bindParam(2, $title);
$stat3->bindParam(3, $description);
$stat3->bindParam(4, $sites);
$stat3->bindParam(5, $category);
$stat3->execute();
header('Location: save.php');
}
?>
I have PHP 7 and I test it on localhost