Problem using two paramenters in preprare statement to login
Posted: Tue May 17, 2016 10:18 am
Hello,
I have a login page and I am trying to use the input username & password to confirm member. Below is my code but it is not echoing the name out.
If I use one parameter like in below code, It will echo out the name. But I must use two (username & password) parameter
Please what could be the problem, because I must use both Email & Password to confirm each member.
Thanks
I have a login page and I am trying to use the input username & password to confirm member. Below is my code but it is not echoing the name out.
Code: Select all
$uname = $_POST[username];
$pword = $_POST[password]:
$get = $dWay->prepare(SELECT firstname, lastname, city FROM members WHERE username=? AND password=?);
$get->bind_param('s, s', $uname, $pword);
$get->execute();
$get->bind_result($fname, $lname, $city);
$get->fetch();
echo $fname;
Code: Select all
$get = $dWay->prepare(SELECT firstname, lastname, city FROM members WHERE username=?);
$get->bind_param('s', $uname);
//OR
$get = $dWay->prepare(SELECT firstname, lastname, city FROM members WHERE password=?);
$get->bind_param('s', $pword);
Thanks