Welcome Guest, Not a member yet? Register   Sign In
something unusual happens on at view
#1

[eluser]Shaser[/eluser]
to access the controller module from the page stays blank, if I remove the query to the database, the view load without problems, any suggestions

Module Function

Code:
function CostumerIDbyUser(){
        $query = $this->db->select('*');
        $query = $this->db->from('tbl_order');
        
        $query = $this->get();
        $row = $query->row();
        
        if($row->customer_id=='' || $row->customer_id== null){
           return 0;
        }else{
            $row->customer_id;
        }
    }

Controller Function

Code:
function newOrder(){
        $tt = $this->mod_temp_orderCustomer->CostumerIDbyUser();
        if($tt>0){
           $dataCostumer = $this->mod_costumer->showCostumer($this->mod_temp_orderCustomer->getCustomerUser(2));
            $existCostumer = 1;
        }
        else{
           $dataCostumer =0;
           $existCostumer = 0;
        }

        $dataProduct = $this->mod_temp_order->dataOrder('2');
        $dataArray = array('rs_costumer'=>$dataCostumer,'rs_productOrder'=>$dataProduct,'rs_existCostumer' => $existCostumer);

        $this->load->view('html_open');
        $this->load->view('head');
        $this->load->view('body');
        $this->load->view('Order/new_Order',$dataArray);
        $this->load->view('html_close');

    }

Thank You
#2

[eluser]CroNiX[/eluser]
Your query or logic in the model doesn't make any sense to me.

It retrieves only a single row in the database, and it doesn't care which one. You are also assigning $query more than once in there. I would assume since the name of the method is CostumerIDbyUser that you want to use a WHERE in your query, so you get a specific user.

So after you retrieve a single row of the database, you check to see if the user id is blank or null. If it is you return 0. If it isn't, you don't return ANYTHING.

So I'm not really sure what you're trying to accomplish here, but it doesn't look right the way it is.

I'm sure there are errors going on, but you are suppressing them which is why you see a blank page. You need to enable error reporting, enable display_errors in php as well as have database debug enabled to see what's going on here.
#3

[eluser]Shaser[/eluser]
Oh sorry I wrote the basic query try to find what happened and I forgot write on the post return $row->customer_id; but I do on my real code and doesn't work I try to enable display_errors to see what’s going on

Thank You
I will told you the result.
#4

[eluser]Shaser[/eluser]
I get this error

Call to undefined method CostumerIDbyUser::get()

why?
#5

[eluser]Tpojka[/eluser]
$this->db->get();
#6

[eluser]Shaser[/eluser]
OMG you will kill me LOL

Thank You




Theme © iAndrew 2016 - Forum software by © MyBB