Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

sqldatasource dal, wwwxxxenden, convert raid5 to raid 10 mdadm, apache force chunked, nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas, linux raid resync after reboot

Links

XODOX
Impressum

#1: Prepared Statements With Multiple Databases

Posted on 2011-10-01 02:26:08 by ron.piggott

------=_NextPart_000_0077_01CC7FAF.2FE23520
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


I need my Prepared Statement database connection to be able to connect =
with two different databases (which use the same username / password).

They are assigned variables

$database1 and $database2

What I have been using so far is:


$dsh =3D 'mysql:host=3Dlocalhost;dbname=3D'. $database1;=20
$dbh =3D new PDO($dsh, $username, $password);=20


Is there a way to amend this with a second database connection?

Ron



www.TheVerseOfTheDay.info=20

------=_NextPart_000_0077_01CC7FAF.2FE23520--

Report this message

#2: Re: Prepared Statements With Multiple Databases

Posted on 2011-10-01 03:34:07 by Phpster

On 2011-09-30, at 8:26 PM, "Ron Piggott" <ron.piggott@actsministries.org> wr=
ote:

>=20
> I need my Prepared Statement database connection to be able to connect wit=
h two different databases (which use the same username / password).
>=20
> They are assigned variables
>=20
> $database1 and $database2
>=20
> What I have been using so far is:
>=20
>=20
> $dsh =3D 'mysql:host=3Dlocalhost;dbname=3D'. $database1;=20
> $dbh =3D new PDO($dsh, $username, $password);=20
>=20
>=20
> Is there a way to amend this with a second database connection?
>=20
> Ron
>=20
>=20
>=20
> www.TheVerseOfTheDay.info=20

A simpler option maybe to use the dbname.tablename syntax to donthe query

Select db1.somefield, db1.anotherfield...


Select db2.somefield, db2.someotherfield

Bastien Koert
905-904-0334=

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this message