hi I'm a kind of a newbie to the MVC in programming. I tried to findout the solution from stackoverflow and other sites by googling but none of are worked for me.
Please guide me where i'm doing mistake.
My controller code:
function getAllusers($id){
global $conn;
$users = [];
$sql = "SELECT * from Users WHERE id=$id";
$ownerdata = mysqli_query($conn, $sql);
while($row = mysqli_fetch_assoc($ownerdata))
{
$users[] = $row;
}
return $users;
}
View (piece of) code:
getAllusers($user_id);
var_dump($users);
In var_dump($users); I'm getting null and in controller if I do var_dump() before return I'm getting an array.
Please, guide me to overcome this. Thank you!