ID: 8831
User Update by: [EMAIL PROTECTED]
Status: Open
Bug Type: MySQL related
Description: a script works on 2 servers I use, and doesn't work on a third one

Okay, I have found a note about mysql_connect() in the manual:
"In case a second call is made to mysql_connect() with the same arguments, no new link 
will be established, but instead, the link identifier of the already opened link will 
be returned."

That can explain what is wrong in my script. However, in older php versions, I could 
do connect again (and get same identifier, I checked), and close it as many times as I 
connected. Now I have to upgrade all my older projects?


Previous Comments:
---------------------------------------------------------------------------

[2001-01-21 20:46:18] [EMAIL PROTECTED]
        Dear Support,

One of my project were must go to another server, and I got a trouble
with my functions.

I try to write a short code to explain it.
This script works well on my computer, windows 98 se, php 4.0.3. Also
works on debian a server, php 4.0.3.
There is another debian server (that was php 4.0.3 too), and this script
crashes on it. I tried to reinstall mysql, php (the new 4.0.4pl), apache,
but that did not help. I show a short code:

------
<?php

$base = mysql_connect('localhost','kepes','***'); // I have a password
of course...
mysql_select_db('KEPES');

$rows = mysql_query("SELECT * FROM ARTICLE_STATE ORDER BY
article_state_id",$base);
test();
$rows = mysql_query("SELECT * FROM ARTICLE_STATE ORDER BY
article_state_id",$base);

mysql_close($base);


function query_more($query,$base) {
  $result = array();
  $data = mysql_query($query,$base);
  while ($row = mysql_fetch_array($data)) {
    $result[] = $row;
  }
//  if ($result) {
//    mysql_free_result($data);
//  }
  return $result;
}

function test() {

$base = mysql_connect('localhost','kepes','***');
mysql_select_db('KEPES');

$rows = query_more("SELECT * FROM ARTICLE_STATE ORDER BY
article_state_id",$base);

mysql_close($base);

}

?>
-----

That outputs nothing on my computer, nothing on the first debian server.
That's ok.
But this outputs on the server where I'd use it the below:

"Warning: Supplied argument is not a valid MySQL result resource in
/home/kepes/public_html/test/test5.php4 on line 16
Warning: 1 is not a valid MySQL-Link resource in
/home/kepes/public_html/test/test5.php4 on line 10"

I figured out this is if I use at least 2 mysql connections same time.
Another interest thing, if I comment out the:
---
  while ($row = mysql_fetch_array($data)) {
    $result[] = $row;
  }
---
part of script, this also works on the 2nd server (but I can't use that way of 
course).

Because my db-scripts are based upon methods like above, I would like to
know what the problem is. I include some php info.

PHP Version 4.0.5-dev
System        Linux ditto 2.2.17 #1 Mon Dec 4 23:29:54 CET 2000 i686 unknown
Build Date   Dec 10 2000
Configure Command './configure' '--with-mysql' '--with-apxs'
Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /usr/local/lib
ZEND_DEBUG disabled
Thread Safety
disabled

---------
mysql

MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.22-beta
MYSQL_INCLUDE
MYSQL_LFLAGS
MYSQL_LIBS

Directive            Local Value            Master Value
mysql.allow_persistent  On  On
mysql.max_links  Unlimited  Unlimited
mysql.max_persistent Unlimited Unlimited

-----

Thank You,

        Mage





---------------------------------------------------------------------------


Full Bug description available at: http://bugs.php.net/?id=8831


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to