I am having an error in mysql and php My code:
$stmt->prepare("INSERT `tablename` (col1,col2,col3) VALUES (?,?,?)");
$stmt->bind_param('sss',$_POST['data'],$sub,$yaxis);
$stmt->execute();
My errors:
Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of variables doesn't match number of parameters in prepared statement.
But I have passed 3s and 3 arguments in bind_param. Why is this error occuring?
Okay, I know this makes me sound stupid but the error was caused by an undefined variable farther up in the script, which I have now fixed. I thought it would not affect this part of the script, but it did. All the answers posted are great, but because of my fault they do not answer the question.