Welcome Guest, Not a member yet? Register   Sign In
MSSQL Pagination Holly Grial?
#11

[eluser]gusa[/eluser]
[quote author="whobutsb" date="1228863348"]
$this->db->select('contactID, firstname, lastname');
$this->db->limit($offset, $limit);
$query = $this->db->get('tblContact');
[/quote]

try specifying the form clause, like this:

Code:
$this->db->select('contactID, firstname, lastname');
$this->db->from('tblContact');
$this->db->limit($offset, $limit);
$query = $this->db->get();

My code looks like what you've written.
#12

[eluser]whobutsb[/eluser]
Cool we're getting somewhere, but now with just that bit of code all, it shows all the results. I tried to manually specify a limit and the offset and the received the "unsupported feature" error.

Sorry about taking so long to reply, I had to setup a web cam for work. Take a look at it! http://www.skatenewport.com/Camera
#13

[eluser]gusa[/eluser]
[quote author="whobutsb" date="1228873100"]Cool we're getting somewhere, but now with just that bit of code all, it shows all the results. I tried to manually specify a limit and the offset and the received the "unsupported feature" error.

Sorry about taking so long to reply, I had to setup a web cam for work. Take a look at it! http://www.skatenewport.com/Camera[/quote]

i did not understand whether you could use the library or not... wrt your website, i've connected but i cant see anything!
#14

[eluser]whobutsb[/eluser]
Problems follow me! The webcam likes to reset itself, and the public access reverts back to allowing no one connect without a user/pass. Its up and running now though.

I"m going to keep playing around with the pagination problem. In the past I used this library to use pagination with MSSQL: http://www.phpclasses.org/browse/package/4634.html , but since I was using CI I wanted to try out their pagination script. Really perplexing on why this doesn't work.
#15

[eluser]whobutsb[/eluser]
Hi Gusa, I decided I would start tackling this pagination script again and I noticed something in the mssql_ext_driver.php script . For the _limit method it reads:

/**
* Limit string
*
* Generates a platform-specific LIMIT clause
*
* @access public
* @param string the sql query string
* @param integer the number of rows to limit the query to
* @param integer the offset value
* @return string
*/
function _limit($sql, $limit, $offset)
{
echo $this->display_error('db_unsuported_feature');
}

That seems like it shouldn't happen. Do I have an outdated script?
#16

[eluser]gusa[/eluser]
[quote author="whobutsb" date="1229725739"]Hi Gusa, I decided I would start tackling this pagination script again and I noticed something in the mssql_ext_driver.php script . For the _limit method it reads:

/**
* Limit string
*
* Generates a platform-specific LIMIT clause
*
* @access public
* @param string the sql query string
* @param integer the number of rows to limit the query to
* @param integer the offset value
* @return string
*/
function _limit($sql, $limit, $offset)
{
echo $this->display_error('db_unsuported_feature');
}

That seems like it shouldn't happen. Do I have an outdated script?[/quote]

hi, whobutsb. it's ok.
mssql_ext overrides DB_active_record's _compile_select method. that method calls _limit, but mssql_ext's does not (however, it manages pagination internally).
mssql_ext's _limit method is never called.
#17

[eluser]whobutsb[/eluser]
Ah thanks for the explaination, i'm still getting the "Unsupported feature of the database platform you are using." error message for some reason. And I can't figure out where it is screwing up. I mean it should be as simple as writing $this->db->limit($limit, $offset);

But that doesn't seem to want to work.
#18

[eluser]gusa[/eluser]
[quote author="whobutsb" date="1229986571"]Ah thanks for the explaination, i'm still getting the "Unsupported feature of the database platform you are using." error message for some reason. And I can't figure out where it is screwing up. I mean it should be as simple as writing $this->db->limit($limit, $offset);

But that doesn't seem to want to work.[/quote]

it should be! are you sure that the error comes from the _limit method?
#19

[eluser]whobutsb[/eluser]
ZOMG! I figuerd it out!!
Here is how my model should've looked:
Code:
function get_all_contacts($limit, $offset){
        $this->db->select('contactID, firstname, lastname');
        $this->db->limit($limit, $offset);
        $this->db->from('tblContact');
        $query = $this->db->get();
        $result = $query->result();
        return $result;
    }

Then in my Controllers I needed:
Code:
$data['contactResults'] = $this->contact_model->get_all_contacts(20, 0)

Thank you for all your help. And sorry for being a pain in the ass with this issue!
#20

[eluser]gusa[/eluser]
[quote author="whobutsb" date="1230077591"]Thank you for all your help. And sorry for being a pain in the ass with this issue![/quote]

;-)




Theme © iAndrew 2016 - Forum software by © MyBB