PHP ERROR : mysqli_stmt_bind_param() Number of variables doesn't match number of parameters in prepared statement -
i facing problem in php file, error comming parameters in third statement, can not find it. here php file:
$client = "test"; $resto = "test"; $st1 = mysqli_query($con, "select client_id clients email = '$client'"); $res1 = mysqli_fetch_array($st1); $clientid = $res1["client_id"]; echo "client id = "; echo $clientid; $st2 = mysqli_query($con, "select restaurant_id restaurants email = '$resto'"); $res2 = mysqli_fetch_array($st2); $restaurantid = $res2["restaurant_id"]; echo "resto id = "; echo $restaurantid; $statement = mysqli_prepare($con, "insert reservations (resto_id, client_id) values ($restaurantid,$clientid)"); mysqli_stmt_bind_param($statement,"ii",$restaurantid,$clientid); mysqli_stmt_execute($statement); $response = array(); $response["success"] = true; echo json_encode($response);
thank in advance help.
change statement bellow
$statement = mysqli_prepare($con, "insert reservations (resto_id, client_id) values ( ? , ? )");
Comments
Post a Comment