Page 1 of 1

User Defined Tag and MySQL

Posted: Thu Aug 31, 2006 9:19 pm
by pspmikek
I've seen some other posts on this, but I'm not totally sure I understand.

In my PHP code, I need to access a different database. So I have this code:

$username="calvary";
$password="XXXXXXXX";
$database="calvarydb";
$server="localhost";

$mylink = mysql_connect($server,$username,$password);
$db_selected = mysql_select_db($database);
if (!$db_selected) {
  die( "Unable to select database");
}

.
blah
.

mysql_close($mylink);

For some reason, that mysql_close is closing the CMS database link?

I know if I leave mysql_close off, it fixes things, but that seems wrong.

Any suggestions would be appreciated.

I have seen other comments about reusing the database connection, but this is to a totally different database?


BTW, CMSMS is totally awesome. I'm loving this.

Mike Kaply

Re: User Defined Tag and MySQL

Posted: Thu Aug 31, 2006 9:23 pm
by pspmikek
Never mind.

According to the docs here:

http://us2.php.net/mysql_close

and the bug here:

http://bugs.php.net/bug.php?id=30525

This is how it works.

No idea why.