I have an interesting problem. By some special reasons Im writing a new module and wanna connect to a none PN database to get some values and then connect to the PN DB and do some stuff there.
I do it something like this.
$dbcon = mysql_connect("localhost",$dbuser,$dbpsw);
mysql_select_db($non_pn_db) or die( "Unable to select database");
$SQL = "some SQL i use"
$res = mysql_query($SQL);
mysql_close($dbcon);
I then do a reqular
$dbconn =& pnDBGetConn(true);
$pntable =& pnDBGetTables();
$SQL = "insert into $table bla bla bla..";
$dbconn->Execute($SQL);
the problem is that the second SQL tries to do the insert on the $non_pn_db database!? Is there a better way to connect to a second database then the first bruteforce way I uses?
// Samuel
- craigh responded to »TagIt 3.0 for Zikula« 03:58 PM
- jmvaughn responded to »error when i try to upgrade to the last version of dizkus module (3.1)« 12:05 PM
- localrags responded to »Remove contents of nuke_sc_anticracker from Database« 11:30 AM
- jmvaughn responded to »Shoutit for zikula 1.3?« 09:31 AM
- mdee responded to »Different page content under one template (tpl file) based on URL« 07:17 AM
- espaan responded to »Categories disappear when editing ...« 08. Feb
- eledril responded to »How decrease zikula cpu usage« 08. Feb
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
connect to other mysql database
-
- Rank: Helper
- Registered: Jan 29, 2004
- Last visit: Oct 21, 2009
- Posts: 852
Take a look at this thread that deals with a similar problem. Make you sure you read it all. The solution is all the way at the bottom
HTH -
- Rank: Legend
- Registered: Dec 11, 2002
- Last visit: Oct 21, 2009
- Posts: 11674
By the way, there will be an API in PostNuke .8 to establish a new database connection object to avoid this type of problem.
--
itbegins.co.uk - Zikula Consulting
birtwistle.me.uk - Personal Blog
Please read the Support Guide -
- Rank: Team Member
- Registered: Jul 21, 2007
- Last visit: May 24, 2010
- Posts: 67
hi hammerhead,
this is exactly what im searching for now, 1.5 years later.
can you give me some more information about that, pls?
many thanks in advance :)
philipp(2)
- Moderated by:
- Support
Users on-line
- 0 users
This list is based on users active over the last 60 minutes.
