php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15899 RC from INSERT INTO if incorrect
Submitted: 2002-03-06 09:39 UTC Modified: 2002-06-02 00:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: rene dot wunderlich at milaro dot net Assigned:
Status: No Feedback Package: MySQL related
PHP Version: 4.1.2 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: rene dot wunderlich at milaro dot net
New email:
PHP Version: OS:

 

 [2002-03-06 09:39 UTC] rene dot wunderlich at milaro dot net
hi all


   $my_sql = "INSERT INTO $table ( my_time ) values( NOW())";

   if(!$my_res = mysql_query($my_sql,$my_db))
   {echo "ERROR query<BR>".mysql_error($my_db);}

   $test1 = mysql_insert_id();
   $test2 = mysql_affected_rows($my_db);
   echo "<p>my result $test1 $test2 <br>";

the correct result from $test1 if 1..9 and from $test2 = 1 

the entry in the db is correct
plz test this link

http://62.72.17.147/bug.php4
http://62.72.17.147/bug.phps

and the mysql db for local test's

http://62.72.17.147/bug.txt

sorry for my bad englich ;)

Rene

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-06 09:53 UTC] mfischer@php.net
The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit http://www.php.net/support.php
 [2002-03-06 09:54 UTC] mfischer@php.net
I failed to see what problem you try to describe?
 [2002-03-06 10:35 UTC] andreas at milaro dot net
Hi 
I try to describe the problem.
The MySQL warning is no problem. The result is 0 but it should be have a value not zero!!! All of these three functions should be a correct result and not 0. They gaves me false values. Please try it with an older version of PHP.
 [2002-03-06 10:55 UTC] hholzgra@php.net
1) from the manual http://php.net/mysql_query: 
"Only for SELECT,SHOW,DESCRIBE or EXPLAIN statements, mysql_query() returns a new result identifier that you can pass to mysql_fetch_array() and other functions dealing with result tables."

so the error checkeing for mysql_query() doesn't make sense
for  INSERT queries


2) if mysql_insert_id() still returns 0 after removing
the error checking then you might have a mysql client
lib problem

when using php with mysql as an apache module, and other
apache modules use mysql, too, you have to make sure 
php is compiled against the system-wide mysql client lib
and not the one that is bundled with php by specifying
'--with-mysql=/path/to/mysql/inst' when configuring php,
usually path is /usr or /usr/local

 [2002-06-02 00:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 21:01:30 2024 UTC