connect external database pdo

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
uloloi
Forum Members
Forum Members
Posts: 88
Joined: Thu Dec 16, 2010 8:50 pm

connect external database pdo

Post by uloloi »

Hi, is it possible to connect another external database using pdo? Something like this:

Code: Select all

try {
    $dbh = new PDO('mysql:host=localhost;dbname=mydb', $user, $pass);
    $dbh->exec("SET CHARACTER SET utf8");
    $dbh = null;
} catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die();
}
How can I connect the database? I don't know :(

I'm trying to make an autocomplete field, so I need to bring data as json encoding from another database
Post Reply

Return to “The Lounge”