Hi! I'm trying to run the following query, and I'm having trouble with the wildcard.
function getStudents() {
global $db;
$users = array();
$query = $db->prepare("SELECT id, adminRights FROM users WHERE classes LIKE ? && adminRights='student'");
$query->bind_param('s', '%' . $this->className . '%');
$query->execute();
$query->bind_result($uid, $adminRights);
while ($query->fetch()) {
if (isset($adminRights[$this->className]) && $adminRights[$this->className] == 'student')
$users[] = $uid;
}
$query->close();
return $users;
}
I'm getting an error that states: Cannot pass parameter 2 by reference. The reason I need to use the wildcard is because the column's data contains serialized arrays. I guess, if there's an easier way to handle this, what could I do?
Thanks in advance!