Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 800913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:21:46+00:00 2026-05-14T23:21:46+00:00

OK, I’m flummoxed. I’m trying to execute a query on a database (locally) and

  • 0

OK, I’m flummoxed.
I’m trying to execute a query on a database (locally) and I keep getting a connection reset error. I’ve been using the method below in a generic DAO class to build a query string and pass to Zend_Db API.

public function insert($params) {
    $loop = false;
    $keys = $values = '';
    foreach($params as $k => $v){
        if($loop == true){
            $keys   .= ',';
            $values .= ',';
        }
        $keys   .= $this->db->quoteIdentifier($k);
        $values .= $this->db->quote($v);
        $loop = true;
    }

    $sql = "INSERT INTO " . $this->table_name . " ($keys) VALUES ($values)";

    //formatResult returns an array of info regarding the status and any result sets of the query
    //I've commented that method call out anyway, so I don't think it's that
    try {
        $this->db->query($sql);
        return $this->formatResult(array(
                true,
                'New record inserted into: '.$this->table_name
        ));
    }catch(PDOException $e) {
        return $this->formatResult($e);
    }
}

So far, this has worked fine – the errors have been occurring since we generated new tables to record user input. The insert string looks like this:

INSERT INTO tablename(`id`,`title`,`summary`,`description`,`keywords`,`type_id`,`categories`) VALUES ('5539','Sample Title','Sample content','
\'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In et pellentesque mauris. Curabitur hendrerit, leo id ultrices pellentesque, est purus mattis ligula, vitae imperdiet neque ligula bibendum sapien. Curabitur aliquet nisi et odio pharetra tincidunt. Phasellus sed iaculis nisl. Fusce commodo mauris et purus vehicula dictum. Nulla feugiat molestie accumsan. Donec fermentum libero in risus tempus elementum aliquam et magna. Fusce vitae sem metus. Aenean commodo pharetra risus, nec pellentesque augue ullamcorper nec. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nullam vel elit libero. Vestibulum in turpis nunc.\'','this,is,a,sample,array',1,'category title') 

Here are the parameters it’s getting before assembling the query (var_dump):

array
    'id' => string '1' (length=4)
    'title' => string 'Sample Title' (length=12)
    'summary' => string 'Sample content' (length=14)
    'description' => string '<p>'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In et pellentesque mauris. Curabitur hendrerit, leo id ultrices pellentesque, est purus mattis ligula, vitae imperdiet neque ligula bibendum sapien. Curabitur aliquet nisi et odio pharetra tincidunt. Phasellus sed iaculis nisl. Fusce commodo mauris et purus vehicula dictum. Nulla feugiat molestie accumsan. Donec fermentum libero in risus tempus elementum aliquam et magna. Fusce vitae sem metus. Aenean commodo pharetra risus, nec pellentesque augue'... (length=677)
    'keywords' => string 'this,is,a,sample,array' (length=22)
    'type_id' => int 1
    'categories' => string 'category title' (length=43)

The next port of call was checking the limits on the table, since it seems to insert if the length of “description” is around the 300 mark (it varies between 310 – 330). The field limit is set to VARCHAR(1500) and the validation on this field won’t allow anything past bigger than 1200 with HTML, 800 without.

The real kicker is that if I take this sql string and execute it via the command line, it works fine – so I can’t for the life of me figure out what’s wrong.

I’ve tried extending the server parameters i.e.
Unexpected Connection Reset: A PHP or an Apache issue?

So, in a nutshell, I’m stumped. Any ideas?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:21:47+00:00Added an answer on May 14, 2026 at 11:21 pm

    OK, for anyone else experiencing this problem – the issue is to do with Zend_Db_Statement – or rather the preg library that this component relies on. It’s been flagged in the Zend issue tracker: http://framework.zend.com/issues/browse/ZF-8399, but its not strictly a problem with the Zend lib. You may or may not experience this problem depending on your server environment. In my case, this error occurred on:

    Win XP,
    Wamp 2
    PHP 5.3

    It can be resolved by using

    db->getConnection()->exec($sql)
    

    which effectively executes the sql directly via the adapter (PDO etc). Alternatively, you can modify your server to rectify segfaulting in PCRE itself (though I confess I’m not entirely sure how you’d go about this). Hope that helps anyone else with the same issue

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.