CodeIgniter Forums
error code 1096? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: error code 1096? (/showthread.php?tid=23702)



error code 1096? - El Forum - 10-19-2009

[eluser]tnathos[/eluser]
mmm i dont know for what show me this error if the select works fine..

Code:
function getPreguntas()
    {    
        $this->db->select('idPregunta');
        $this->db->from('jgo_asignadas_prefree');
        $this->db->where('estado','PD');
        $this->db->where('id',$this->session->userdata('id'));
        $query = $this->db->get();    
        if($query->num_rows() > 0){        
            return $this->db->get();
        }
    }

the curious is if quit $query = $this->db->get(); and the (if) and only put return $this->db->get();, yes works... any?


error code 1096? - El Forum - 10-19-2009

[eluser]tnathos[/eluser]
help me Smile


error code 1096? - El Forum - 10-20-2009

[eluser]CroNiX[/eluser]
Code:
<?php
function getPreguntas()
{    
    $this->db->select('idPregunta');
    $this->db->from('jgo_asignadas_prefree');
    $this->db->where('estado','PD');
    $this->db->where('id',$this->session->userdata('id'));
    $query = $this->db->get();    
    if($query->num_rows() > 0){        
        return $query;
    }
}
I believe where you issue the $this->db->get(); 2x is causing the error. Just return the result.


error code 1096? - El Forum - 10-20-2009

[eluser]tnathos[/eluser]
ok works. thanks