Welcome Guest, Not a member yet? Register   Sign In
How to pass parameter via URL?
#6

[eluser]Sinclair[/eluser]
Thanks for your reply, but I can't get working.

It works if I have this:

- Model:
Code:
function getAnunciosZona($pzona) {
   $query = $this->db->query("select id_anuncio, n_anuncio from atw_anuncios where id_zona = '".$pzona."' ");
   return $query->result();
    }

- Controller:
Code:
function index() {
   $this->load->model('acomp_model');    
   $data['result'] = $this->acomp_model->getAnunciosZona('SP');
        
   $this->load->view('anuncios', $data);
    }


But if I have this, when I call the second segment, gives me an error.

I call the parameter like this: http://www.example.com/anuncios/SP

- Model:
Code:
function getAnunciosZona($pzona) {
   $query = $this->db->query("select id_anuncio, n_anuncio from atw_anuncios where id_zona = '".$pzona."' ");
   return $query->result();
    }

- Controller:
Code:
function index() {
   $this->load->model('acomp_model');    
   $data['result'] = $this->acomp_model->getAnunciosZona($pzone = $this->uri->segment(2));
        
   $this->load->view('anuncios', $data);
    }

What I'am doing wrong?

Best Regards,


Messages In This Thread
How to pass parameter via URL? - by El Forum - 10-13-2009, 02:48 PM
How to pass parameter via URL? - by El Forum - 10-13-2009, 02:59 PM
How to pass parameter via URL? - by El Forum - 10-13-2009, 03:03 PM
How to pass parameter via URL? - by El Forum - 10-13-2009, 03:14 PM
How to pass parameter via URL? - by El Forum - 10-13-2009, 03:25 PM
How to pass parameter via URL? - by El Forum - 10-13-2009, 03:29 PM
How to pass parameter via URL? - by El Forum - 10-13-2009, 03:36 PM
How to pass parameter via URL? - by El Forum - 10-13-2009, 05:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB