Welcome Guest, Not a member yet? Register   Sign In
[Pagination Return 404 Page Not Found Except 1st Page] Plz help...stucked for about 5 hours already....lol
#1

[eluser][email protected][/eluser]
config/config.php
Code:
$config['base_url'] = 'http://10.9.44.118/user_files/chenwei_huang/analyst/';

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = 'index.php';

config/routes.php

Code:
$route['libs/jquery/(:any)']='../libraries/jquery/$1';
$route['libs']='../libraries';
$route['report/(:any)'] = 'report/$1';
$route['report'] = 'report';
$route['post/create'] = 'post/create';
$route['post/(:any)'] = 'post/view/$1';
$route['post'] = 'post';
//$route['(:any)'] = 'pages/view/$1';

$route['register/(:any)'] = "register/index";
//$route['register']="register/user_register" ;
$route['default_controller'] = "home";//This is the controller will trigger once site url is inputed.
$route['404_override'] = '';


controller/report.php
Code:
<?php
class Report extends CI_Controller {

public function __construct()
{
  parent::__construct();
  $this->load->database();
  //$this->load->model('report_model');
  $this->load->helper('url');
  
  
  
}//__construct() END

public function index() {
  
  $this->load->library('pagination');
  $this->load->library('table');
  $config['base_url']= "http://10.9.44.118/user_files/chenwei_huang/analyst/index.php/report";
  //$query = $this->db->query('SELECT * FROM tb_testresult');
  $config['total_rows']= 1000;//$this->db->get('testresult_id')->num_rows();//$query->num_rows();
  $config['per_page'] = 50;
  $config['num_links']= 20;
  
  $this->pagination->initialize($config);
  $data['records'] =$this->db->get('tb_testresult',$config['per_page'],$this->uri->segment(3));  
  $this->load->view('templates/header');
  $this->load->view('report/index.php',$data);
  $this->load->view('templates/footer');
  
}//index() END

public function view($pos_slug){
}//view() END

public function create() {
}//create() END
}//Report Class END
?>

view/report/index.php

Code:
<div id="container">
<h1>Record Pagniation Page</h1>
&lt;?php
$this->load->helper('url');
echo 'HERE should be pagination appear if correctly setup.<br>';

/* echo $this->pagination->create_links();
echo 'Below is the Content shoudl have value.';
echo $config['total_row'];
echo $config['per_page'];
echo $config['num_links'];*/

echo $this->table->generate($records);
echo $this->pagination->create_links();
//echo 'Below is the page number: <br>'.$report.config['per_page'];
?&gt;


</div>


I tried to follow these tutorials
simi-outdated, but the only one available lol

read about pages such as :
http://ellislab.com/codeigniter/user-gui...elper.html
http://ellislab.com/codeigniter/user-gui...ation.html


But still, I can not make it work. Please help, I am so darn desperate..............
#2

[eluser]jairoh_[/eluser]
you can refer to this thread http://ellislab.com/forums/viewthread/235744/

#3

[eluser][email protected][/eluser]
[quote author="jairoh_" date="1370565886"]you can refer to this thread http://ellislab.com/forums/viewthread/235744/

[/quote]

Hi, Thanks Jairoh, but your solution mentioning your method is not using active record. Could you elaborate what is the good about not using it? Also, in my case, what I need to change in order to cope with your binding method?

Thank you
#4

[eluser]jairoh_[/eluser]
the problem with active records is you get spaghetti codes in some like 20+ lines of query codes in complex systems. because if your main aim is just to protect from sql injection, query binding also escape special characters.

go at the bottom:
http://ellislab.com/codeigniter/user-gui...eries.html


this is what i use.
#5

[eluser][email protected][/eluser]
[quote author="jairoh_" date="1370573303"]the problem with active records is you get spaghetti codes in some like 20+ lines of query codes in complex systems. because if your main aim is just to protect from sql injection, query binding also escape special characters.

go at the bottom:
http://ellislab.com/codeigniter/user-gui...eries.html


this is what i use.[/quote]

Thanks the info! \
Thanks!
#6

[eluser][email protected][/eluser]
Resolution:
FINALLY I FOUND IT!!!!!!!! ON MY GOD!!!!!!!!!!!!!!!!!!!!!!! ITS SO SIMPLE!!!!!!!!!!!!! lol

Code:
$config['base_url']= "http://10.9.44.118/user_files/chenwei_huang/analyst/index.php/report/index";//the LAST INDEX IS THE KEY!!!!!!!!!!!!!!!!!!!!!!! because that is the actual page where directed to!!!!!!!!!!!!

add the index after the report... thats all you need! because that is the page where actualy displayed according to my routes! Smile

Share my joy and hopefully it helps lots other people save their time to developer a wonderful web app Big Grin

Best and Peace,




Theme © iAndrew 2016 - Forum software by © MyBB