using prepared statement and mysqli I'm trying to insert the bellow data into a table. When I run the code I get this error even though I'm following a tutorial from w3school.
here is my code:
$dbServerName = "localhost";
$dbUserName = "root";
$dbPassword = "";
$dbName = "candiadateDB";
$conn = mysqli_connect($dbServerName,$dbUserName,$dbPassword,$dbName);
$stmt_values = $conn->prepare("INSERT INTO candidates (username, firstname, lastname, password, coalition,program, starting_year, slogan, email) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt_values->bind_param("sssssssss",$username, $firstname, $lastname, $password, $coalition,$program, $starting_year, $slogan, $email);
$stmt_values->execute();
$stmt_values->close();
$conn->close();
I'm retrieving the variables $username, $fname,.. like so from a form:
$fname = mysqli_real_escape_string($conn,$_POST['fname']);
here is the error: Fatal error: Call to a member function bind_param() on a non-object in