SmartyPaginate issues...I think

From: Date: Tue, 21 Feb 2006 16:27:00 +0000
Subject: SmartyPaginate issues...I think
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-13329@lists.php.net to get a copy of this message
I need a second pair of eyes. When I run my query to just pull out the data and using Smarty put it in a table it works fine. Now I want to throw pagination into the picture. When I run it with pagination I get a "memory cannot be read" error. Pagination is the last thing I need to actually start using this seriously. Any help or suggestions would be greratly appreciated. Using: Oracle 9.2.0.2 Smarty (latest) SmartyPaginate (latest) PHP 5.1.2 === PAGER.PHP === session_start(); require('config.inc.php'); // has all the requires, etc. try {
    $db = NewADOConnection("oci8");
    $db->Connect('****', '****', '****');
    $db->SetFetchMode(ADODB_FETCH_ASSOC);
} catch (exception $e) {
    var_dump($e);
    adodb_backtrace($e->gettrace());
} $page = new Page(); SmartyPaginate::connect(); SmartyPaginate::setLimit(25); $page->assign('results', get_db_results()); SmartyPaginate::assign($page); $page->display('pager.tpl'); function get_db_results() {
    $rs = $db->Execute("
        SELECT dstrct_code, entity, rtrim(global_profile) as GLOBAL
        FROM msf020
        WHERE entry_type = 'S'
    ");
    while ($arr = $rs->fetchRow()) {
        $data[] = $arr;
    }
    SmartyPaginate::setTotal(count($data));
    return array_slice($data, SmartyPaginate::getCurrentIndex(),
        SmartyPaginate::getLimit());
} ==== PAGER.TPL ==== {* Smarty *} {* :mode=html: *} <html> <head> <title>Paging Test</title> </head> <body> {* display pagination header *} Items {$paginate.first}-{$paginate.last} out of {$paginate.total} displayed. {* display results *} <table> <tr> <th>DISTRICT</th> <th>ENTITY</th> <th>GLOBAL PROFILE</th> </tr> {section name=res loop=$results} <tr>
    <td>{$results[res].DSTRCT_CODE}</td>
    <td>{$results[res].ENTITY}</td>
    <td>{$results[res].GLOBAL}</td>
</tr> {/section} </table> {* display pagination info *} {paginate_prev} {paginate_middle} {paginate_next} </body> </html>

« previous php.smarty.general (#13329) next »