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

  • SEARCH
  • Home
  • 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 1046117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:05:38+00:00 2026-05-16T16:05:38+00:00

i am getting the error Cannot refresh row as parent is missing when I

  • 0

i am getting the error “Cannot refresh row as parent is missing” when I try to save. Here is my code

abstract class Webapp_Model_Resource_Db_Table_Abstract
extends Zend_Db_Table_Abstract
{
    /**
     * Save a row to the database
     *
     *
     * @param array             $info The data to insert/update
     * @param Zend_DB_Table_Row $row Optional The row to use
     * @return mixed The primary key
     */

    public function saveRow($info, $row = null)
    {         
        if (null === $row) {
            $row = $this->createRow();
        }
        $columns = $this->info('cols');
        foreach ($columns as $column) {
            if (array_key_exists($column, $info)) {
                $row->$column = $info[$column];
            }
        }

        return $row->save();
    }
}

when I call the saveRow() method, I pass in the $_POST values ($form->getValues())

I have reused this class with my other modules in the same application but now I am getting this error and I am not sure why. My table is pretty straight forward:

CREATE TABLE `news` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `headline` varchar(100) DEFAULT NULL,
  `snippet` varchar(500) DEFAULT NULL,
  `full_text` text,
  `author` varchar(100) DEFAULT NULL,
  `publish_from` date DEFAULT NULL COMMENT 'Publish date',
  `publish_to` date DEFAULT NULL COMMENT 'Take it down or mark as draft after this date',
  `datecreated` timestamp NULL DEFAULT NULL COMMENT 'First created on',
  `revised` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp for the last time it was revised',
  `draft` tinyint(1) DEFAULT '0' COMMENT 'Should not be published',
  `departments_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=214 DEFAULT CHARSET=utf8 COMMENT='Stores news articles';

Anyone know what I am doing wrong?

::::::::::::::ADDTION:::::::::::::

public function saveNews($post,$defaults = array())
    {

       //get the form
        $form = $this->getForm('article' . ucfirst($validator));
        //validate
        if(!$form->isValid($post)) {
            return false;
        }


      //get fitered values
        $data = $form->getValues();
        //apply defaults
        foreach($defaults as $col => $value) {
            $data[$col] = $value;
        }

      //get the article if it exists
        $article = array_key_exists('id', $data) ?
                   $this->getNewsById($data['id']) : null;


        return $this->saveRow($data, $article);
}
  • 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-05-16T16:05:39+00:00Added an answer on May 16, 2026 at 4:05 pm

    When you pass an empty value for the primary key, Zend seems to return this value instead of the inserted auto-increment value – even though a new row is created properly with an auto-increment value, the inserted value will not be returned.

    Maybe your problem is related to this. If so, try unsetting the id field prior to saving.

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

Sidebar

Related Questions

i'm getting error cannot find symbol in netbeans while using the below code for
I am getting error: cannot declare pointer to 'void' member for below code. template
I'm getting this error: Cannot find interface declaration for 'BaseViewController', superclass of 'ViewController'. Here's
I have this code below and I'm getting the error upon compilation: error: cannot
Getting error with the following code: import java.util.Scanner; public class FahrenheitToCelsius{ public static void
I am writing the code right, but getting error - missing namespace or assembly
I'm trying to convert integer data to string , but I'm getting error cannot
I am getting the error Cannot add task ':webserver:build' as a task with that
I am getting the error Cannot resolve TargetName grdGeneral . What I am trying
On the query below I keep getting this error: Cannot read the next data

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.