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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:57:51+00:00 2026-05-19T23:57:51+00:00

I am preparing to update a live web server from PHP 5.2.12 to 5.3.5.

  • 0

I am preparing to update a live web server from PHP 5.2.12 to 5.3.5. In preparation, I have performed the update on a second server which is a mirror of the live one (“dev” server). Both servers are using FreeBSD, and both used ports to install PHP and MySQL. The live server is using MySQL 5.0.89, the newly upgraded dev server is using 5.1.54.

The following code executes as expected on the live server (PHP 5.2.12/5.0.89), returning the value of the AUTO_INCREMENT row that was just inserted. This function is part of a database class that is used throughout the site, where “$this->_private[‘cn’]” is the resource link.

 public function insert ($sql=false) {
    @mysql_select_db($this->_private['db_name'],  $this->_private['cn']);
    $res = null;            
    if (false !== $sql) {
        $query_obj = mysql_query($sql, $this->_private['cn']);
        if ($query_obj)
            $res = mysql_insert_id($this->_private['cn']);
    }
    return $res;
}

On the dev server (5.3.5/5.1.54), the return is zero. Note – not null (which is returned if the query fails), but ZERO. I can look at the table and verify that a new row has in fact been inserted, and the auto increment field has properly advanced. The field value is currently at 121288, so it is well within PHP’s integer range. I’ve even re-created the class’s code on a simple page and get the same result. mysql_error() indicates no failures. Error reporting is set to E_ALL, not a peep there.

ARGH! Any ideas?

  • 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-19T23:57:52+00:00Added an answer on May 19, 2026 at 11:57 pm

    see this bug which recommends following your query with SELECT LAST_INSERT_ID()

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

Sidebar

Related Questions

I'm preparing to create a WCF Service which our customers can use to update
I've been preparing to deliver a presentation on SQL Server Compact Edition 3.5 (SP1
I'm preparing to send mass email to customers which is in html + images.
I'm preparing for a job interview. I was stuck at one of the binary
Preparing a proposal for my team, I have the obvious ones. Ibatis is retired,
I'm preparing to deploy my Django app and I noticed that when I change
My application is preparing a cover-sheet for submitting documents by fax. I identify the
I am preparing to use continuous integration for the first time. I will be
I'm preparing a class on Visual Basic 2005 targeting Visual Basic 6 programmers migrating
I'm preparing a class on Visual Basic 2005 targeting Visual Basic 6 programmers migrating

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.