We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

$DB class stops pulling content if there are more than X entries...

Development and Programming

Toby Sommer's avatar
Toby Sommer
27 posts
16 years ago
Toby Sommer's avatar Toby Sommer

Hi there!

I try to build an ExpressionEngine plugin, but I figured out, that the $DB class stops pulling content, if there are more than (in my case: 967) entries. I created a new table in my EE database. This table contains several information which are imported from an older system. There are now about 7600 rows in there. My plugin looks like this:

<?php
$plugin_info = array(
                        'pi_name'            => 'Test',
                        'pi_version'        => '1.0',
                        'pi_author'            => 'Toby Sommer',
                        'pi_description'    => 'LIMIT',
                        'pi_usage'            => ''
                    );

class My_plugin
{
    private $_sql;

    public function __construct()
    {
        $this->_sql = "SELECT * FROM _misc_data";
    }

    public function test()
    {
        global $DB;

        $query = $DB->query($this->_sql);
        
        $id = array();
        
        if ($query->num_rows > 0)
        {
            foreach ($query->result as $row)
            {
                $id[] = $row['id'];
            }
        }
        
        return utf8_encode(implode(', ', $id));
        
    }
    /* END */


}
// END CLASS
?>

I also created a “one line template” inside a template group named “export”:

{exp:{segment_2}:{segment_3}}

And I call this template with: “http://mysite/export/my_plugin/test/”

But nothing returns. Just a blank page.

So I tried to add a “LIMIT 0, 10” to my $_sql variable and it just works. After playing around with the limit, 967 was the highest one. 968 and above does not work.

I really don’t see there a problem? Or do I have to tell EE, that I use a DB table which is “unknown” to it? Do I have to acquaint my DB table with EE?

Thanks for the help!

       
John Henry Donovan's avatar
John Henry Donovan
12,339 posts
16 years ago
John Henry Donovan's avatar John Henry Donovan

Toby,

I am going to move this to the Plugin Technical Assistance forum for you

For that blank page after setting your limit to 967 entries, lets try and get some sort fo error reporting going on. Cuuld be a resource exhausted

EE Wiki : HowTo Turn on Error Reporting

       
Toby Sommer's avatar
Toby Sommer
27 posts
16 years ago
Toby Sommer's avatar Toby Sommer

Thank you very much for the wiki link… I tried to put the error_reporting inside the template =)

Anyway… it says: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 607904 bytes) in /Users/toby/Projects/ee/system/db/db.mysql.php on line 411

PS: This error occurs even if I put the PHP inside a template. This is why I posted it into the tech support 😉

       
John Henry Donovan's avatar
John Henry Donovan
12,339 posts
16 years ago
John Henry Donovan's avatar John Henry Donovan

Toby,

Your php memory is rather low. Can you try upping that?

Another wiki link for you 😊

EE Wiki : HowTo Override Memory Limitations

       
Toby Sommer's avatar
Toby Sommer
27 posts
16 years ago
Toby Sommer's avatar Toby Sommer

John,

thank you very very much! This does the tick! Great 😊

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.