Fatal error: Call to undefined method mysqli_result::fetch_all() in...
Necesito reestructurar mi código para utilizar fetch_assoc() o = y retornar todas las filas. Investige algo para hacerlo con un loop (while) pero no lo logro.
Función con fetch_all
Código:
Whilefunction getMenusuno() { global $conex; $respuesta= mysqli_query ($conex, "SELECT M.menu_nombre, M.menu_ruta FROM privilegios P INNER JOIN menus M ON P.menu_id = M.menu_id WHERE tipousu_id='".$_SESSION['resultipo']."' AND M.menu_id BETWEEN '1' AND '4' ORDER BY p.menu_id ASC"); $respuesta->fetch_all(); }
Código:
Como puedo reestructurar mi código o mi consulta para hacerlo.???? El while va dentro o fuera de la función.??? Estaré muy agradecido por su ayuda. $data = array(); while ($row = $respuesta->fetch_assoc()) { return $data[] = $row; }