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 8373959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:48:43+00:00 2026-06-09T14:48:43+00:00

I am inserting data in Zend framework with the db adapter $adapter = Zend_Db_Table::getDefaultAdapter();

  • 0

I am inserting data in Zend framework with the db adapter

$adapter = Zend_Db_Table::getDefaultAdapter();

and execute an insert statement like this:

$q = "INSERT INTO questions (category_id, user_id, `text`, active) 
VALUES($category_id, ".$user_id.", '".$question_text."', 1)";
$adapter->query($q);

However sometimes this query does not work. This only happens when $question_text is pretty long (>1000 chars) and does not depend on the content but only the length. Executing the same statement in phpmyadmin works without problems. (The db field is a text)

When I use

$adapter->exec($q);

the query works fine as well.

Now my questions:

What’s causing the problem for the query() statement?

Are there any downsides to use exec() instead?

  • 1 1 Answer
  • 0 Views
  • 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-06-09T14:48:44+00:00Added an answer on June 9, 2026 at 2:48 pm

    If you change the insert to use the object oriented interface which escapes your input data for you, do you still have the problem?

    $values = array('category_id' => $category_id,
                    'user_id'     => $user_id,
                    'text'        => $question_text,
                    'active'      => 1);
    
    $inserted = $adapter->insert('questions', $values);
    

    $inserted should contain the number of rows affected by the operation, 1.

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

Sidebar

Related Questions

I am facing the problem while inserting data this way. How to insert data
There are ways of inserting data into table: insert into MyTable (ColA, ColB, ColC)
I am inserting data into my database using the following code: $this->db->set('event_id', $event_id); ...
i am inserting data that looks like this: AA00000111 PSNH-OT J, SMITH 03/01/2011 10/11/1957
This is a pretty simple problem. Inserting data into the table normally works fine,
Before inserting data into table i need to check against duplicate records and report
I am inserting data into localstorage with key that starts with G: What I
I have following code for inserting data into database using PDO. It inserts data
I get the following error when inserting data from mysql into postgres. Do I
In my c# application i am inserting data into sqlite database as below String

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.