im getting the errors:
Warning: mysqli_prepare() expects parameter 1 to be mysqli, resource given in C:\xampp\htdocs\add_tool.php on line 75
Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, null given in C:\xampp\htdocs\add_tool.php on line 76
Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, null given in C:\xampp\htdocs\add_tool.php on line 77
Warning: mysqli_stmt_affected_rows() expects parameter 1 to be mysqli_stmt, null given in C:\xampp\htdocs\add_tool.php on line 79
heres the code it refers to:
if(empty($errors)) {
$q = 'INSERT INTO tools (tool_name, price, spec1, image_name) VALUES (?, ?, ?, ?)';
$stmt = mysqli_prepare($dbc, $q);
mysqli_stmt_bind_param($stmt, 'sdss', $tn, $p, $spec1, $i);
mysqli_stmt_execute($stmt);
if(mysqli_stmt_affected_rows($stmt) == 1) {
echo '<p>The tool has been added.</p>';
$id = mysqli_stmt_insert_id($stmt);
rename($temp, "../uploads/$id");
$_POST = array();
} else {
echo '<p style="font-weight: bold; color: #C00">Your submission could not be processed due to a system error.</p>';
}
mysqli_stmt_close($stmt);
}
i cannot see where the problem is. could anyone please help?
thank