My code is as follows:
include('config.php');
$mysqli = new mysqli(DBHOST, DBUSER, DBPASS, DBNAME);
$statement = $mysqli->prepare("INSERT INTO brickTable (url, description) VALUES(?,?)");
$statement->bind_param("ss", $_POST["url"], $_POST["description"]);
I keep getting the error "Call to a member function bind_param() on boolean". I've looked all over S.O., and found several examples, but none that solved my issue. I don't see any syntax or typo errors in my code. Using a var_dump, I know that the $_POST["url"] and $_POST["description"] exist and are being received properly.
Thoughts or help?
First turn on error reporting by adding the below two lines at the top of your page. Then try printing out the exact error by doing echo $mysli->error;
error_reporting(E_ALL);
ini_set('display_errors', 1);
$mysqli = new mysqli(DBHOST, DBUSER, DBPASS, DBNAME);
$statement = $mysqli->prepare("INSERT INTO brickTable (url, description) VALUES(?,?)");
echo $mysqli->error;
$statement->bind_param("ss", $_POST["url"], $_POST["description"]);
$statement->execute();
It will tell you the error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With