You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 62 guest(s) and 2 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - MySQL Connection Problem [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
TheWing
Nuke Soldier
Nuke Soldier


Joined: Aug 13, 2003
Posts: 13


PostPosted: Fri Oct 17, 2003 12:49 pm Reply with quoteBack to top

Is it possible for a block to connect to another database on MySQL considering the connection information is correct?

_________________
http://flamingpost.com
Find all posts by TheWingView user's profileSend private message
arnoldkrg
Major
Major


Joined: Aug 03, 2003
Posts: 936

Location: United Kingdom

PostPosted: Fri Oct 17, 2003 2:39 pm Reply with quoteBack to top

I thought to myself "I might need to do that one day". So I spent the last half hour or so figuring it out. Yes it is possible. I tested it by adding the following code to the bottom of the whosonline block.

Code:
$dbthis = @mysql_connect("localhost", "username", "password");
        if (!$dbthis)
        {
               $content .="<p>Connected to host</p>";
        }
        else
        {$content .="<p>Connected to host</p>";}
        if (! @mysql_select_db("2nd database name",$dbthis))
        {
          $content .="<p> Not connected to database</p>";     
        }
         else {$content .="<p>Connected to database</p>";}
         mysql_close();
         include "config.php";
         require_once ("mainfile.php");
         $db = new sql_db($dbhost, $dbuname, $dbpass, $dbname, false);
      if(!$db->db_connect_id) {
       message_die(CRITICAL_ERROR, "Could not connect to the database");
      }


Seems you have to close the 2nd dbase connection and reconnect back to the nuke dbase or everything else stops working......thats what lines from mysql_close do. Try it out substituting your own passwords etc.

_________________
Image
Find all posts by arnoldkrgView user's profileSend private messageSend e-mailVisit poster's website
TheWing
Nuke Soldier
Nuke Soldier


Joined: Aug 13, 2003
Posts: 13


PostPosted: Fri Oct 17, 2003 5:00 pm Reply with quoteBack to top

Scratch that - I got it to work - w000000t

Very Happy

Edit:
Forgot this forum doesn't do "This post was editted x times"

I literally had my code layed out with like 5 questions. I appreciate your help. Your post worked for me. Smile Ever need anything cruise over to the site listed in my sig Smile

_________________
http://flamingpost.com
Find all posts by TheWingView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.386 Seconds - 341 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::