خرید بک لینک
Good morning, sorry if this is a duplicate question but I have not been having any luck trying to solve this issue.

I am trying to create a session for either a Manager or CSR and I have done a union to select the information from my database. When i check the query in the database it works but every time I attempt to log in with either or credentials it gives me the following error (mysqli_stmt_bind_param(): Number of variables doesn't match number of parameters in prepared statement).

This is my code that reflects were the error may be.

//Declare all Global Page Variables

$information = "";

$id = 0;
$fn = "";
$ln = "";
$p = "";
$b = "";


//Retrieve Form Details from POST

$Yourname = $_POST ['username'];
$Yourpass = $_POST ['password'];

//Validate Form Details
$information = validateLogininData ($Yourname, $Yourpass);

//Check if Validation successful
if($information != ""){ //Validation failed

Header("Location:index.php?informationMsg=$information");

}else{ //Validation passed

//coect to DB
require ("data/dbCoection.php");


//Prepare SQL Statement
if($stmt = mysqli_prepare($mysqli,
"SELECT mangID AS staffID, firstname, lastname, positionName, assignedBranch
FROM tblManager
WHERE username = ? AND password = ?
UNION
SELECT csrID AS staffID, firstname, lastname, positionName, assignedBranch
FROM tblCSR
WHERE username = ? AND password = ?")){


//Bind Parameter to SQL Statement
mysqli_stmt_bind_param($stmt, "ss", $Yourname, $Yourpass);

//Execute SQL Statement
if(mysqli_stmt_execute($stmt)){


//Store results of Query
mysqli_stmt_bind_result($stmt, $id, $fn, $ln, $p, $b);

Can someone please assist me, I will be very grateful.

Regards
deedee10

برچسب: نویسنده: آیلین رضوانی تاريخ: دوشنبه 27 آذر 1396 ساعت: 7:55

صفحه بندی