Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
connect to other mysql database
  • Posted: 27.01.2006, 19:10
     
    samuelb
    rank:
    Freshman Freshman
    registered:
     June 2005
    Status:
    offline
    last visit:
    21.04.06
    Posts:
    12
    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
  • Posted: 27.01.2006, 19:17
     
    ainigma32
    rank:
    Professional Professional
    registered:
     January 2004
    Status:
    offline
    last visit:
    22.03.06
    Posts:
    958
    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 icon_wink

    HTH
  • Posted: 27.01.2006, 20:33
     
    Simon
    rank:
    Steering Committee Steering Committee
    registered:
     December 2002
    Status:
    offline
    last visit:
    09.11.08
    Posts:
    13413
    By the way, there will be an API in PostNuke .8 to establish a new database connection object to avoid this type of problem.

    --
    Regards,
    Simon

    itbegins.co.uk - Zikula Consulting

    Please read the Support Guide
  • Posted: 28.07.2007, 22:48
     
    philipp2
    rank:
    Freshman Freshman
    registered:
     July 2007
    Status:
    offline
    last visit:
    14.11.08
    Posts:
    19
    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)

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula