php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43870 mysql_query() return true on error using UPDATE
Submitted: 2008-01-16 19:13 UTC Modified: 2008-01-16 23:09 UTC
From: tbrasta at gmail dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.2.5 OS: Ubuntu 7.10
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tbrasta at gmail dot com
New email:
PHP Version: OS:

 

 [2008-01-16 19:13 UTC] tbrasta at gmail dot com
Description:
------------
It doesn't matter if a $file variable contains valid file name or just a string of no sense, in both cases mysql_query() returns 'true'. When the valid file name is being used the load is successful.


Reproduce code:
---------------
mysql_query("INSERT INTO ssert(id, file) VALUES(NULL, '')", $link);
$id = mysql_insert_id($link);
$file = "/no/such/file";
if(mysql_query("UPDATE ssert SET file=LOAD_FILE('$file') WHERE id=$id", $link))
{
  echo 'Success';
}
else
{
  echo 'False';
}

Expected result:
----------------
Expected 'False' on file not loaded into the database since /no/such/file does not exist.

Actual result:
--------------
mysql_query("UPDATE ssert SET file=LOAD_FILE('$file') WHERE id=$id", $link) returns true although the file does not exist.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-16 23:09 UTC] scottmac@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

If the file does not exist or cannot be read because one of the preceding conditions is not satisfied, the function returns NULL.

So it won't return an error.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 18 21:00:03 2025 UTC