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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:09:33+00:00 2026-06-03T04:09:33+00:00

When I update a record, I’m using the result from ‘update’ to determine if

  • 0

When I update a record, I’m using the result from ‘update’ to determine if it worked correctly.

$a = $this->db->insert(self::TABLE, $saveData);

$a = 1 means that it updated one record. $a = 0 means that it didn’t update anything. I can get a 0 if there was nothing changed in the form. But I also assume I can get a 0 if there was an error.

I’d like to be able to tell the user that the information was not updated because they didn’t change anything or that there was an actual error of some sort.

Am I correct that an error returns 0 or does it return -1?

When ever I try to produce an error to check this, all I get is a Zend error that’s not attractive and frankly rather un-useful.

  • 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-03T04:09:35+00:00Added an answer on June 3, 2026 at 4:09 am

    If the query failed due to a server error, or malformed query or invalid data, you will get an exception as opposed to a return value. So to do what you want, you can do something like this:

    try {
        $a = $this->db->insert(self::TABLE, $saveData);
    
        if ($a == 0) {
            // return no data was updated
        } else {
            // return data was updated
        }
    } catch(Zend_Exception $ex) {
        // query did NOT execute successfully
        // call $ex->getMessage() for the actual error
        // return failure result
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to update a record from an Ms-Access table with VB.NET and ASP.NET.
I'm using a detailsview control to update a record, however in this particular case
I am trying to update a record from an index using either jQuery alone
I want to update a record in a table. I'm using Kohana 3.0 and
I have a table where on a single record update, a trigger adds a
In Oracle, is it possible to INSERT or UPDATE a record (a row) through
I am trying to update an existing record in a database using CoreData, but
I'm trying to update a single record in a table, but when I run
I'm using following update or insert Oracle statement at the moment: BEGIN UPDATE DSMS
I want to update a record in a table but based on a condition

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.