
May 28th, 2003, 05:12 PM
|
|
|
|
Join Date: Apr 2007
Location: Omaha, NE
Posts: 23
Time spent in forums: 13 sec
Reputation Power: 0
|
|
|
I thought PEAR was supposed to be the hottest thing since sliced cheese
Okay, I've got PHP 4.3.1 with PEAR up and going finally. Until today, I've been using the basic
Code:
mysql_connect($host,$user,$pass);
mysql_select_db($db);
I thought I'd try this cool PEAR deal I keep reading about that's supposed to make life so easy. So, I set up a basic query that just pulls records and prints them from one table:
Code:
require 'DB.php';
$dsn = array(
'phptype' => 'mysql',
'hostspec' => 'localhost',
'database' => 'links',
'username' => 'user',
'password' => 'pass'
);
$dbh = DB::connect($dsn);
$stmt = "SELECT * FROM tbl_website ORDER BY sitename";
$result = $dbh->simpleQuery($stmt, DB_FETCHMODE_ASSOC);
while ($dbh->numRows($result) > 0)
{
$data = (object) $dbh->fetchRow($result, DB_FETCHMODE_ASSOC);
echo "siteid => $data->siteid<br />n";
echo "sitename => $data->sitename<br />n";
echo "url => <a href="$data->url">$data->url</a><br />n";
}
It just chugs - takes forever!! Is there something I'm doing wrong, or does PEAR simplify programming at the cost of performance?
|