php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2757 MySQL-Connection gets lost at file upload
Submitted: 1999-11-18 18:45 UTC Modified: 2000-07-24 16:36 UTC
From: volker at vskm dot org Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.0 Beta 2 OS: BSD/OS 4.0.1 (VServers)
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: volker at vskm dot org
New email:
PHP Version: OS:

 

 [1999-11-18 18:45 UTC] volker at vskm dot org
If you try to upload a file with a HTML form any MySQL-Link gets lost.
Example:
<?php
$conn=mysql_connect(HOST,USER,PASSWORD);
$db=mysql_select_db(DBNAME,$conn);
mysql_query("select max(id) from TABLE",$db);
?>
<html>
  <form enctype="multipart/form-data"  method="POST">
  <input type="file" name="uploadfile">
  <input type="submit">
  <form>
</html> 

If you choose a file this error occurs: Warning: 1 is not a MySQL link index in FILENAME on line 4
Without choosing a file everthing is OK.

I can't say anything about the configuration because I'm only consumer of vservers.com, but you
may look at http://www.vskm.org/errors/phpinfo.php3 where you can see the output of the 
phpinfo() function.

Same error occurs in PHP Version 3.0.7 which is part of
the SuSE Linux 6.1 distribution.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-11-19 00:08 UTC] volker at vskm dot org
It's the same problem with msql.
 [1999-11-25 17:33 UTC] zeev at cvs dot php dot net
What do you mean by it getting lost?

Are you submitting a file upload to a PHP page that has
a MySQL link opened in it?  Does it not open?  Does it open
and then suddenly close?

I'm not sure if the example you enclosed represents a single file (in which case it's a really weird script) or two files, in which case I don't understand when the SQL handle may get lost...
 [2000-03-18 11:20 UTC] mrobinso at cvs dot php dot net
In the snippet provided, you are not providing
the mysql_query() function with a link identifier, as
described in the manual.

Try:

mysql_query("select max(id) from TABLE",$conn);
                                        ^^^^^
Same goes for msql.



 [2000-07-24 16:36 UTC] david@php.net
Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 13:01:33 2025 UTC