Answer the question
In order to leave comments, you need to log in
Alternative to get_result() in mysqli?
Hello!
There is the following code:
$query = $this->DB->prepare("SELECT * FROM photos WHERE id = ? AND authkey = ?");
$query->bind_param('is', $_COOKIE['photoid'], $_COOKIE['authkey']);
$query->execute();
$result = $query->get_result();
if ($result->num_rows != 0) {
// user exist
$this->userLogged = true;
$this->userData = $result->fetch_assoc();
return $this->userData;
} else {
return false;
}
Answer the question
In order to leave comments, you need to log in
1. The most convenient alternative is safemysql , the code will be halved
$sql = "SELECT * FROM photos WHERE id = ?s AND authkey = ?s";
$row = $db->getRow($sql, $_COOKIE['photoid'], $_COOKIE['authkey']);
if ($row)
{
$this->userLogged = true;
$this->userData = $row;
return TRUE;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question