ID: 31728 Updated by: [EMAIL PROTECTED] Reported By: godwizard at hotmail dot com -Status: Feedback +Status: No Feedback Bug Type: MySQL related Operating System: Linux Fedora Core 2 PHP Version: 5.0.3 New Comment:
No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. Previous Comments: ------------------------------------------------------------------------ [2005-02-28 20:55:54] [EMAIL PROTECTED] What we can't reproduce we can't fix. So either provide the short example script as requested or let this report rot. ------------------------------------------------------------------------ [2005-01-30 00:45:28] godwizard at hotmail dot com Problem is that the code is not public (the previous one that I published, is now public but everything else will not be. Boss will hang me if I publish code more). Even DB's are closed. I have tested that the sample code is making same error all the time, so nothing else is needed. Let's make it simple: When you make query in class 1, the query is ok and it will return to mysql_insert_id() correct value. When you make query in class 2, the query is ok (everything in DB [MySQL] is ok and correct values have been inserted) BUT mysql_insert_id() is getting value from query 1 (class 1), not from query 2 like it should be. Without classes everything is ok (all code is working without problems), but with classes everything goes straight to... Class 1 is STAT and class 2 is ADMIN_DOG_SQL. Is that clear now? ------------------------------------------------------------------------ [2005-01-28 21:40:01] [EMAIL PROTECTED] >Here is all code what U will need... I don't need *all* your code, I need only a small reproduce code that doesn't use any external resources (except MySQL, of course). Please, reduce the code, as I'm unable to run it without your session data, functions used, contants etc. etc. Also, provide a table structure dump (you can also provide some sample data). Put in somewhere in the net and post URL here if possible. ------------------------------------------------------------------------ [2005-01-27 20:08:22] godwizard at hotmail dot com Description: ------------ mysql_insert_id return wrong ID. It will add new line to DB correctly but when using mysql_insert_id to get auto_increment value, it will return something odd. Reproduce code: --------------- function add_line() { global $db_insert; $aikaleima = time(); if ( (isset($_SESSION['admin']['rekisteriID'])) && (strlen($_SESSION['admin']['rekisteriID']) > 0) ) { $query = sprintf(" insert into rekisteri_rekisteriID (rekisteriID, oletus, lisatty, lisaaja) values (%s, 1, %u, %u)", sql_valid($_SESSION['admin']['rekisteriID']), sql_valid($aikaleima), sql_valid($_SESSION['user']['userID'])); if ( (isset($db_insert)) && (isset($query)) ) { $result = $db_insert->query($query); unset($query); } if ( (isset($result)) && (mysql_affected_rows() > 0) ) { $rekisterinro = mysql_insert_id(); } .... Expected result: ---------------- Example value should be 29171. Actual result: -------------- Value is 7618. And ID 7618 is already reserved in DB. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31728&edit=1