Mysqli Throws "Warning: MySQLi_Stmt_Bind_Param() Expects Parameter 1 to Be MySQLi_Stmt, Boolean Given"

Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given?

It seems that you have a missing parameter, you should have 13 parameters and 13 ? check the two parameters after password. (I took out signupdate) try the below :

$stmt = mysqli_prepare(
$db_conx,
"INSERT INTO $storenameTable (firstname, lastname, username, address_1, address_2, postcode, country, county, city, email, password, storeShop) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
);
//after validation, of course
mysqli_stmt_bind_param($stmt, "issi", $firstname, $lastname, $username, $address_1, $address_2, $postcode, $country, $county, $city, $email, $hashedPass, $storenameTable);
mysqli_stmt_execute($stmt); <//<<<<<<<< line 92
if (mysqli_affected_rows($db_conx)) <//<<<<<<<< line 93
{
mysqli_stmt_close($stmt); <//<<<<<<<< line 96
//update was successful
$id = mysqli_insert_id($db_conx);
}

You also can get more details on the last error by using var_dump(mysqli_error($db_conx));

fixing mysql errors mysqli_stmt_bind_param()

I think that you might have problem in your connection file mysqli_connect.php

Here is my code for your reference

define("DB_HOST", "localhost");
define("DB_USERNAME", "username");
define("DB_PASSWORD", "password");
define("DB_NAME", "database name");
$dbc = mysqli_connect(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME);

With this connection parameters I've executed your code and its working.

Also please change the line echo mysqli_error(); to echo mysqli_error($dbc);

The mysqli_error accepts one parameter which is the connection link.

Update Statement Error with MySQLi

$query_task_update = "update tasks set display_order=? where task_id=?";

$stmt_task_update = mysqli_prepare($dbc, $query_task_update);

mysqli_stmt_bind_param($stmt_task_update, "ii", $display_order, $last_task_id);

mysqli_stmt_execute($stmt_task_update);


Related Topics



Leave a reply



Submit