CodeIgniter Forums
Basic controller method not working!!? - 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: Basic controller method not working!!? (/showthread.php?tid=58149)



Basic controller method not working!!? - El Forum - 05-20-2013

[eluser]behnampmdg3[/eluser]
Hi;

localhost/secure/results/ shows a list of products:
Code:
class Results extends CI_Controller {

public function index($record_starts=0)
  {
   $data = array('title'=>'Mysql Php MVC, the right way', 'header'=>'Search for a product');
   $this->load->model('model_products');
   $data['results'] = $this->model_products->results_products($this->session->userdata('search_data'), $record_starts);
   $this->load->view('results',$data);
   $this->output->enable_profiler(TRUE);
  }

}

Why do I get 404 from localhost/secure/results/12502Thanks


Basic controller method not working!!? - El Forum - 05-21-2013

[eluser]TheFuzzy0ne[/eluser]
CodeIgniter is looking for a method named "12502".

You'll need do one of the following:
a) Call your URL like this: localhost/secure/results/index/12502
b) Set up a [url="http://ellislab.com/codeigniter/user-guide/general/routing.html"]route[/url]
c) Use [url="http://ellislab.com/codeigniter/user-guide/general/controllers.html#remapping"]_remap()[/url] and reroute the call (probably overkill).