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 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 have three tables as a SQLITE3 Dump. products,tax,inventory From these tables preparing a
I have released my app to the market and I'm preparing an update. However,
I've been preparing to deliver a presentation on SQL Server Compact Edition 3.5 (SP1
I have strings which contains thousand separators, however no string-to-number function wants to consume
UPDATE: this error is shown during git push heroku master : -----> Preparing app
We have an application that has one or more text console windows that all
We're preparing to create a web-centred platform for schools, and we were planning to
I'm working on the design of a web app which will be using AJAX
I am developing an android app (only Widget) which displays some images from a

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.