I am getting an error back on my INSERT query
Fatal error: Call to a member function bind_param() on boolean in...
although I am only inserting strings into the table columns which are expecting string values :: VARCHAR(255)
My table looks like this:
+---------------+--------------+-----+------+---+--+--+
| id | int(11) | NO | PRI | | | |
| username | varchar(45) | YES | UNI | | | |
| email_address | varchar(45) | YES | UNI | | | |
| password | varchar(255) | YES | | | | |
| role | int(11) | YES | NULL | 0 | | |
| dashboard_id | int(11) | YES | NULL | | | |
+---------------+--------------+-----+------+---+--+--+
And my Php looks like this...
$stmt = $conn->prepare("INSERT INTO users VALUES (?, ?, ?)");
$stmt->bind_param('sss', $username, $emailAddress, $upassword);
$username = $_POST['username'];
$emailAddress = $_POST['email'];
$upassword = password_hash($_POST['upassword'], PASSWORD_DEFAULT);
$stmt->execute();
printf("%d Row inserted.\n", $stmt->affected_rows);
$stmt->close();
$conn->close();
UPDATE
My connection code:
$conn = new mysqli($db_host,$db_user,$db_password,$db_name);
Fatal error: Call to a member function bind_param() on boolean in...would indicate that$stmtis false, and therefore yourpreparehasn't worked.