La función es esta:
Código PHP:
y me señala la línea donde está: $q = $this->db->query($sql);Ver original
public function export_to_excel($fec, $gru) { $fecha = $fec; $sql = ""; switch ($gru) { case '1': $sql = "SELECT A.codigo AS codigo, B.nombres AS nombres, B.apellidos AS apellidos, B.grado AS grado, B.seccion AS seccion, C.nombre AS entrada, D.nombre AS fondo, E.nombre AS postre FROM selcomidaspadres A INNER JOIN alumnos B ON A.hijo = B.codigo INNER JOIN comidas C ON A.entradas = C.codigo INNER JOIN comidas D ON A.fondos = D.codigo INNER JOIN comidas E ON A.postres = E.codigo WHERE A.fecha = '" . $fecha . "' AND (B.grado = 1 OR B.grado = 2) ORDER BY B.grado, B.seccion"; break; case '2': $sql = "SELECT A.codigo AS codigo, B.nombres AS nombres, B.apellidos AS apellidos, B.grado AS grado, B.seccion AS seccion, C.nombre AS entrada, D.nombre AS fondo, E.nombre AS postre FROM selcomidaspadres A INNER JOIN alumnos B ON A.hijo = B.codigo INNER JOIN comidas C ON A.entradas = C.codigo INNER JOIN comidas D ON A.fondos = D.codigo INNER JOIN comidas E ON A.postres = E.codigo WHERE A.fecha = '" . $fecha . "' AND (B.grado = 3 OR B.grado = 4 OR B.grado = 5) ORDER BY B.grado, B.seccion"; break; case '3': $sql = "SELECT A.codigo AS codigo, B.nombres AS nombres, B.apellidos AS apellidos, B.grado AS grado, B.seccion AS seccion, C.nombre AS entrada, D.nombre AS fondo, E.nombre AS postre FROM selcomidaspadres A INNER JOIN alumnos B ON A.hijo = B.codigo INNER JOIN comidas C ON A.entradas = C.codigo INNER JOIN comidas D ON A.fondos = D.codigo INNER JOIN comidas E ON A.postres = E.codigo WHERE A.fecha = '" . $fecha . "' AND (B.grado = 6 OR B.grado = 7) ORDER BY B.grado, B.seccion"; break; case '4': $sql = "SELECT A.codigo AS codigo, B.nombres AS nombres, B.apellidos AS apellidos, B.grado AS grado, B.seccion AS seccion, C.nombre AS entrada, D.nombre AS fondo, E.nombre AS postre FROM selcomidaspadres A INNER JOIN alumnos B ON A.hijo = B.codigo INNER JOIN comidas C ON A.entradas = C.codigo INNER JOIN comidas D ON A.fondos = D.codigo INNER JOIN comidas E ON A.postres = E.codigo WHERE A.fecha = '" . $fecha . "' AND (B.grado = 8 OR B.grado = 9) ORDER BY B.grado, B.seccion"; break; case '5': $sql = "SELECT A.codigo AS codigo, B.nombres AS nombres, B.apellidos AS apellidos, B.grado AS grado, B.seccion AS seccion, C.nombre AS entrada, D.nombre AS fondo, E.nombre AS postre FROM selcomidaspadres A INNER JOIN alumnos B ON A.hijo = B.codigo INNER JOIN comidas C ON A.entradas = C.codigo INNER JOIN comidas D ON A.fondos = D.codigo INNER JOIN comidas E ON A.postres = E.codigo WHERE A.fecha = '" . $fecha . "' AND (B.grado = 10 OR B.grado = 11) ORDER BY B.grado, B.seccion"; break; default: break; } $q = $this->db->query($sql); if ($q->num_rows() > 0) { return $q->result(); } else { return false; } }
Por favo, denme una luz acerca de esto.
Muchas garcias,