|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
edduvs Smarty Rookie
Joined: 27 Jun 2011 Posts: 10
|
Posted: Tue Jul 05, 2011 7:52 pm Post subject: Fatal error: Allowed memory size of 134217728 bytes exhauste |
|
|
Hi there again, my problem resums at the SmartyPaginate.class.php
First when i installed the script, i needed to make all functions beside the cunstructor in the SmartyPaginate class public statics, because i needed to make a static call on a nonstatic function. Anyway, thats solved now, after that, no errors got in my way, but this error came in.
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 35 bytes) in C:\xampp\htdocs\actions\ally_in_ally_members.php on line 11
Code: |
<?php
global $tpl;
session_start();
include('inc/libs/SmartyPaginate.class.php');
function get_db_results() {
global $user;
$lista = array();
$sql = db('query','SELECT id,username,ally_found FROM users WHERE ally = '.$user['ally'].' ORDER BY points DESC');
while($sql) $lista[] = $sql;
SmartyPaginate::setTotal(count($lista));
return array_slice($lista, SmartyPaginate::getCurrentIndex(),
SmartyPaginate::getLimit());
}
SmartyPaginate::connect();
SmartyPaginate::setLimit(20);
SmartyPaginate::setLastText('LAST');
SmartyPaginate::setFirstText('FIRST');
$tpl->assign('results', get_db_results());
SmartyPaginate::assign($tpl);
$tpl->display('game_ally_in_ally_members.tpl');
?>
|
What's wrong with this one ? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Jul 05, 2011 8:17 pm Post subject: |
|
|
You need to apply the index/limit to your SQL query. You are selecting everything and filling memory. |
|
Back to top |
|
edduvs Smarty Rookie
Joined: 27 Jun 2011 Posts: 10
|
Posted: Wed Jul 06, 2011 2:47 pm Post subject: |
|
|
Damn, didn't see that i didn't add global $user to the first global setter. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|