function db() {
$con = new mysqli('localhost','root','','signupsystem') or die( 'eroor in connection'. mysqli_connect_error()); /* db connection */
$query = "select * from adduser where email =? AND password =?";
$this->strm = $con->prepare($query); /* query prepare */
if (!$this->strm) {
die($con->error);
}
$this->strm->bind_param('ss', $this->email, $this->password);
$this->strm->execute(); /*execute query */
if ($this->strm->affected_rows > 0) {
echo "successfully login";
} else {
echo "error in logIn";
}
}
答案 0 :(得分:0)
你正在做一个select语句,所以没有affected_row。在execute语句之后,您需要将结果绑定到变量,然后遍历查询结果。
$stmt->bind_result($col1, $col2);
/* fetch values */
while ($stmt->fetch()) {
echo $col1, $col2;
}