The error occurs on line 22
$insert->bind_param('sss', $make, $model, $desc);
and that's rest of the code:
<?php
error_reporting(E_ALL); ini_set('display_errors', 'On');
require 'connect.php';
require 'function/security.php';
//creating empty array
$records = array();
//check if data is available
if(!empty($_POST)) {
if(isset($_POST['make'], $_POST['model'], $_POST['desc'])) {
$make = trim($_POST['make']);
$model = trim($_POST['model']);
$desc = trim($_POST['desc']);
//check if thay empty
if(!empty($make) && !empty($model) && !empty($desc)) {
//prepering statement
$insert = $db->prepare("INSERT INTO type ('make', 'model', 'desc') VALUES(?, ?, ?)");
///sss represents 3 strings
$insert->bind_param('sss', $make, $model, $desc);
//executing prepared statement
if($insert->execute()) {
header('Location: form.php');
die();
}
}
}
}
//creating if statement and assigning results variable
if($results = $db->query("SELECT * FROM type")) {
if($results->num_rows) {
while($row = $results->fetch_object()) {
$records[] = $row;
}
$results->free();
}
}
?>
Just can't figure it out what's wrong with it, went thru hundreds of tutorials and read all post with same topic in stackoverflow and still can't find the error. Please help
Thanks for all your help, I sorted it out... only 10 hours took me to realize my table is called desc and its Mysql reserved word!