User Defined Tag and MySQL

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
pspmikek

User Defined Tag and MySQL

Post 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
pspmikek

Re: User Defined Tag and MySQL

Post 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.
Post Reply

Return to “Developers Discussion”