Welcome Guest, Not a member yet? Register   Sign In
Active Record and mssql_data_seek
#1

[eluser]0plus1[/eluser]
Hi, I'm currently using active record with mssql2000, I need to use the msssql_data_seek php command, how do I do it with an Active Record query?

Thank you
#2

[eluser]dmorin[/eluser]
On the result object that you get back after running a query, you can call $result->_data_seek($n) which calls mssql_data_seek($result_id, $n) on the query results. Note that CI intends this to be a private method, but because they don't actually declare it as private, you can call it yourself. Another option is to just call mssql_data_seek and related functions yourself specifying the first param as $result->result_id where $result is the return value of the query.
#3

[eluser]0plus1[/eluser]
[quote author="dmorin" date="1272314937"]On the result object that you get back after running a query, you can call $result->_data_seek($n) which calls mssql_data_seek($result_id, $n) on the query results. Note that CI intends this to be a private method, but because they don't actually declare it as private, you can call it yourself. Another option is to just call mssql_data_seek and related functions yourself specifying the first param as $result->result_id where $result is the return value of the query.[/quote]

Thank you.
I actually did it a bit different:

ADDED a parameter in result_array called $offset.
This parameter is being passed to _data_seek($offset).
#4

[eluser]Beertastic[/eluser]
I've tried the _data_seek() option and I'm still not getting an offset.
I've checked and the function is still not officially set to private.

I'm hoping my syntax is just off... any ideas?

Code:
public function get_data($offset, $per_page)
{
    $result = $this->db->get('my_table_data', $offset, $per_page);
    $result->_data_seek($offset);
    echo $this->db->last_query();
    return $result->result_array($offset);
}




Theme © iAndrew 2016 - Forum software by © MyBB