CodeIgniter Forums
Sick Error - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Sick Error (/showthread.php?tid=20425)

Sick Error - El Forum - 07-09-2009


I dont know if this is a codeigniter error but I didnt find a solution for this problem.

the problem is that I have a big mssql query which returns me an array which the controller sends to the view the code for that is:

function filter()
            $kanr = $this->Join_Model->getKanr($_REQUEST['kanr']);
                $abtfc = $this->Join_Model->getABTFC($_REQUEST['fa']);
                $arrabtfc = array();
                foreach($abtfc as $row)
            $config['base_url'] = 'http://intra/scripts/lkfem/index.php?c=anzeige&m=filter&kanr;='.$_REQUEST['kanr'].'&fa;='.$_REQUEST['fa'].'&errc;='.$_REQUEST['errc'].'&kategorie;='.$_REQUEST['kategorie'].'&sortieren;='.$_REQUEST['sortieren'].'&ewh;='.$_REQUEST['ewh'].'&status;='.$_REQUEST['status'].'&wert;='.$_REQUEST['wert'].'&bearbeitet;='.$_REQUEST['bearbeitet'].'';
            $config['per_page'] = '20';
            $config['page_query_string'] = TRUE;
            $config['first_link'] = 'Erste';
            $config['last_link'] = 'Letzte';
            //echo $this->pagination->create_links();
            $messages = $this->Anzeige_Model->getFilterMessages(trim($kanr->KANR),$arrabtfc,$_REQUEST['status'],$_REQUEST['ewh'],$_REQUEST['kategorie'],$_REQUEST['errc'],$_REQUEST['sortieren'],$_REQUEST['wert'],$_REQUEST['bearbeitet'],$config['per_page'],$_REQUEST['per_page']);
            $row = $messages->row();
            $config['total_rows'] = $row->TotalRows;
            #echo "test";
            $data = array(
                'title' => 'Meldungen Filtern',
                'content' => 'content/admin_meldungen_content',
                'sidebar' => 'navig/admin_filter_kanr',
                'messages' => $messages->result_array(),
                'totalmessages' => $row->TotalRows,
                'subheader' => $this->session->userdata ( 'subheader' ),
                'pages' => $this->pagination->create_links(),
                'errorcodes' => $this->Anzeige_Model->getErrorCodes($kanr->KANR,$arrabtfc),
                'kanrs' => $this->Anzeige_Model->getKanr(),
                'werte' => $this->Anzeige_Model->getWerte($kanr->KANR,$arrabtfc),
                'fachrichtungen' => $this->Anzeige_Model->getFachrichtung($_REQUEST['kanr']));

if I start the page I get an the action is aborted error from the browser. If I put an echo "test" in the code, it works, it takes several seconds for the query but it works.

What can be the problem?

Sick Error - El Forum - 07-09-2009

I'd suggest enabling the profiler, and then pasting each query directly into phpMyAdmin or equivalent, and timing them. You may find that the problem is to do with memory, or slow queries. You can enable the profiler for the controller method by adding:

to the top of your controller method. Now might also be a good time to check your table indexes. How many rows of data do you have in your table(s)?

Sick Error - El Forum - 07-09-2009

thank you for the replie, i enabled the profiler but nothing really happend.

In one of the table I join I have about 50k rows ... Yeah it is a bit slow but it works fine when I put something out in the controller or the model.

No URI data exists CLASS/METHOD
anzeige/filter MEMORY USAGE BENCHMARKS Loading Time Base Classes 0.0219
Controller Execution Time ( Anzeige / Filter ) 5.3262
Total Execution Time 5.3483
GET DATA $_GET['c'] anzeige
$_GET['m'] filter
$_GET['kanr'] LKH
$_GET['kategorie'] MEDDOK
$_GET['ewh'] Warning
$_GET['status'] neu
No POST data exists QUERIES Database driver is not currently loaded

this is my query its a bit complicated becauce of the page pagination in mssql:

$where = '';
        if($kanr!=null && $kanr!="alle")
            $where .= " AND ERRORMESSAGE.KANR = '".$kanr."'";
        if($abtfc!=null && $abtfc!="alle")
            $where .= " AND ERRORMESSAGE.ABTFC IN (".implode(",",$abtfc).")";
            #$kuerzel = $this->Join_Model->getKuerzelABTFC($abtfc);
            #$where .= " AND STAMMDATEN.KUERZEL IN ('".implode(",",$kuerzel)."')";
        if($status!=null && $status!="alle")
            $where .= " AND EMSTATUS.STATUS = '".$status."'";
        if($ewh!=null && $ewh!="alle")
            $where .= " AND ERRORMESSAGE.E_W = '".$ewh."'";
        if($kategorie!=null && $kategorie!="alle")
            $where .= " AND EWSTAMMDATEN.KATEGORIE = '".$kategorie."'";
        if($errc!=null && $kanr!="alle")
            $where .= " AND ERRORMESSAGE.EWCODE = '".$errc."'";
        if($wert!=null && $wert!="alle")
            $where .= " AND ERRORMESSAGE.WERT = '".$wert."'";
            if($bearbeitet == 3)
                $join = "JOIN USERS ON (USERS.USER_ID = EMSTATUS.USER_ID)";
                $join = "JOIN USERS ON (USERS.USER_ID = EMSTATUS.ADMIN_ID)";
            $where .= " AND USERS.GRUPPE_ID = ".$bearbeitet."";    

            $sort = "order by ERRORMESSAGE.".$sort." desc";
            $sort = 'order by ERRORMESSAGE.ERR_ID desc';
        if(empty($offset)) $offset = 0;
          $query =    $this->db->query("
            select TOP ".$num." * from (
                SELECT ROW_NUMBER() over (".$sort.") as RowNumber,
                        ERRORMESSAGE.ERR_ID as ERR_ID,
                        ERRORMESSAGE.KANR as ERR_KANR,
                        ERRORMESSAGE.ABTFC AS ERR_ABTFC,
                        ERRORMESSAGE.EWCODE AS ERR_EWCODE,
                        ERRORMESSAGE.WERT AS ERR_WERT,
                        ERRORMESSAGE.ERR_ID as ERR_ERR_ID,
                        TotalRows=Count(*) OVER()
                FROM ERRORMESSAGE
                        where ERRORMESSAGE.AKTIV = 1 and ERRORMESSAGE.ABTFC > '0' and ERRORMESSAGE.AZ > '0' ".$where."
                        ) _tmpInlineView
            where RowNumber > '".$offset."'");

        #echo "test";
        return $query;


Sick Error - El Forum - 07-09-2009

To be honest, I don't fully understand what's going on in your code, but I'm fairly sure you don't need to use a transaction for a select query. Smile

Sick Error - El Forum - 07-09-2009

I know, that was only a test ... didnt work as well.

Sick Error - El Forum - 07-09-2009

I didn't notice this line in your previous post until now:

Quote:QUERIES Database driver is not currently loaded

Perhaps this is an indication as to where the problem lies?

Sick Error - El Forum - 07-09-2009

this is a codeigniter bug on php4