[nycphp-talk] OO & database connections
Chris Bielanski
Cbielanski at inta.org
Fri Jul 16 12:43:09 EDT 2004
Hooray!! Another reason to upgrade to MySQL 5 and mysqli_*
Thanks,
Chris Bielanski
Web Programmer,
International Trademark Association,
1133 Avenue of the Americas, 33rd Floor
New York, NY 10036
+1 (212) 642-1745, f: +1 (212) 768-7796
mailto:cbielanski at inta.org, www.inta.org
INTA -- 125 Years of Excellence
> -----Original Message-----
> From: putamare [mailto:jeffknight at mac.com]
> Sent: Friday, July 16, 2004 12:38 PM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] OO & database connections
>
>
> I have confirmed that this is not true for mysqli_, if you have
>
> $dbcon1 = new mysqli($h,$u,$p);
> $dbcon2 = new mysqli($h,$u,$p);
>
> $dbcon1->select_db('db1');
> $dbcon2->select_db('db2');
>
> if ( $result = $dbcon1->query( 'SHOW TABLES' )) :
> while ($row = $result->fetch_row()) echo $row[0] . "<br/>";
> $result->close();
> endif;
>
> Will give you the tables in db1
>
>
>
> On Jul 15, 2004, at 7:57 PM, Chris Snyder wrote:
>
> > I didn't believe this when I first read it, but can confirm:
> >
> > $dbcon1 = mysql_connect( $h, $u, $p );
> > mysql_select_db( 'clew', $dbcon1 );
> >
> > $dbcon2 = mysql_connect( $h, $u, $p );
> > mysql_select_db( 'chxo', $dbcon2 );
> >
> > $result = mysql_query( "show tables", $dbcon1 );
> > while ( $record = mysql_fetch_array( $result ) ) {
> > print $record[0]."<br />";
> > }
> >
> > ... will show the tables in the "second" database, even though the
> > query was sent via the "first" connection.
> >
> > Weird.
>
> Jeff Knight
> putamare not junk at putamare.net
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
More information about the talk
mailing list