php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49562 mysql_info() hides warnings for single-row INSERT's
Submitted: 2009-09-15 13:08 UTC Modified: 2009-09-21 17:13 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jille at hexon dot cx Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.3.0 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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jille at hexon dot cx
New email:
PHP Version: OS:

 

 [2009-09-15 13:08 UTC] jille at hexon dot cx
Description:
------------
mysql_info() returns false when inserting only one row. This results in the unability to retreive the number of warnings which might have occurred.

if $numWarnings > 0 I would like to retreive the warnings with mysql_query("SHOW WARNINGS"); but I'd prefer not doing that if there are no warnings.

Reproduce code:
---------------
mysql_query("CREATE TABLE a (a VARCHAR(4))");
mysql_query("INSERT INTO a (a) VALUES ('abcde')");
var_dump(mysql_info());

Expected result:
----------------
Just like the mysql-CLI:

mysql> INSERT INTO a (a) VALUES ('abcde');
Query OK, 1 row affected, 1 warning (0.01 sec)

so something like "1 row affected, 1 warning" would be perfect

Actual result:
--------------
bool(false)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-16 07:34 UTC] jani@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-09-17 11:47 UTC] uw@php.net
Please see http://bugs.php.net/bug.php?id=49573 for an explanation.

mysql_info() does not return anything for single-row INSERTs and that is how it should be.
 [2009-09-21 10:04 UTC] jille at hexon dot cx
Can you tell me how to retreive the number of warnings without querying 'SHOW WARNINGS' ?
I think mysql_info() is the place where that should be available.
 [2009-09-21 17:13 UTC] uw@php.net
Yes, you need to run SHOW WARNINGS or similar. If you want this to be changed, please file a feature request at bugs.mysql.com. It is not a PHP bug.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 15:01:36 2025 UTC