Welcome Guest, Not a member yet? Register   Sign In
I have a problem with pagenition pls help
#1

[eluser]Fahad Alrahbi[/eluser]
Hello ,all


i am using codeigniter with Smarty template engine and when i try to use pagenition it's working but if Url is

http://localhost/cic/showq/viewv/8
and i add (') or (-) i got error
after add
http://localhost/cic/showq/viewv/-8


error msg is

Quote:A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-8, 4' at line 3

SELECT * FROM (`topic`) LIMIT -8, 4

Filename: C:\xampp\htdocs\cic\system\database\DB_driver.php

Line Number: 330


My Code
controllers :


Code:
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
All Copyrights reserved.
Programmer information
Name : Fahad Salim Alrahbi
Location: Sultanate of Oman - Muscat
Email : [email protected]
Tel : +968 98985262
*/

class showq extends CI_Controller{
    
    
    function viewv(){
        $this->load->library('pagination');
        
        $config['base_url'] = 'http://localhost/cic/showq/viewv';
        $config['total_rows'] =$this->db->get('topic')->num_rows();
      
        $config['per_page'] = 4;
        $config['num_links']=5;
        $config['first_link'] = 'Start';
        $config['last_link'] = 'End';
        $config['prev_link'] = 'Back';
        
    
        $this->pagination->initialize($config);
      
        $s=$this->db->get('topic',$config['per_page'],$this->uri->segment(3));
         foreach($s->result() as $datar){
            
            $row[]=$datar;
         }      
        $this->parser->assign('pages',$this->pagination->create_links());
        $this->parser->assign('row',$row);
        $this->parser->parse('showq.tpl');
    }
}
?>


Template showq.tpl

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html xml:lang="en" lang="en"&gt;

&lt;head&gt;
&lt;meta http-equiv="content-type" content="text/html; charset=UTF-8" /&gt;
&lt;meta name="author" content="PHPDes7" /&gt;

&lt;title&gt;View data &lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;

{section name='idx' loop=$row}

{$row[idx]->id}| {$row[idx]->topic} <br />

{/section}

<br />

{$pages}







&lt;/body&gt;
&lt;/html&gt;


Messages In This Thread
I have a problem with pagenition pls help - by El Forum - 09-17-2012, 11:01 PM
I have a problem with pagenition pls help - by El Forum - 09-18-2012, 12:24 AM
I have a problem with pagenition pls help - by El Forum - 09-18-2012, 12:34 AM
I have a problem with pagenition pls help - by El Forum - 06-19-2013, 06:42 PM
I have a problem with pagenition pls help - by El Forum - 06-22-2013, 04:01 PM
I have a problem with pagenition pls help - by El Forum - 06-23-2013, 07:57 PM
I have a problem with pagenition pls help - by El Forum - 06-24-2013, 01:00 AM
I have a problem with pagenition pls help - by El Forum - 06-24-2013, 08:41 PM
I have a problem with pagenition pls help - by El Forum - 06-24-2013, 10:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB