NassimB
NassimB
Reputation Top 5%
Nassim B.
2 Snippets  (258th place)
Published
1 Channel
Created
1 Channel
Following
51 points  (595th place)
Reputation
Junior Code Generator
Junior Publisher
Junior Trend Maker
Junior Autobiographer
Senior Autobiographer
Junior Famous Coder

Recent Snippets See all snippets by NassimB

public by NassimB  1899  0  5  0

mysql user privileges / grant tables

1.Create user in mysql.user
2.UPDATE user SET Password=PASSWORD('password') WHERE User='user_name';
3.FLUSH PRIVILEGES;
4.GRANT ALL ON database.table TO user_name IDENTIFIED BY 'p@$$vvord';
;

public by NassimB  1433  3  5  0

codeigniter-pagination-url-with-get-parameters

<?
$this->load->library('pagination');
		
$item_per_page = 48;
$total_rows = //query here for total num of items from model
	
// thanks to Aurel for the trick see http://stackoverflow.com/questions/5384644/codeigniter-pagination-url-with-get-parameters
if (count($_GET) > 0) $config['suffix'] = '?' . http_build_query($_GET, '', "&");
	
$config['base_url']  = base_url().'/controller/method/';
$config['first_url'] = $config['base_url'].'0?'.http_build_query($_GET);
	
$config['per_page']  = $item_per_page;
$config['total_rows'] = $total_rows; 
		
$this->pagination->initialize($config);
$data['pagination'] =  $this->pagination->create_links();
	
$offset = $this->uri->segment(3);
if(!$offset) $offset = 0;
$data['result'] = // query with offset and limit ($item_per_page)
	
//call view
$this->load->view("view",$data)
;