Almost forgot, in PHP 4.x you can use references to reduce your memory
overhead (note the &s):
<?php
// Include the PEAR DB Abstraction class
require_once('DB.php');
// Set the values for your DSN
$dsn = "mysql://user:[EMAIL PROTECTED]/database";
// Instantiate the class
$objDB =& DB::Connect($dsn);
/* Tell PearDB to set the FetchMode to an Associative Array
* Other possibilites are:
* DB_FETCHMODE_ORDERED - Ordered Array
* DB_FETCHMODE_OBJECT - Object
* More Info:
http://pear.php.net/manual/en/package.database.db.db-common.setfetchmode.php
*/
$objDB->setMode(DB_FETCHMODE_ASSOC);
// Limit query, just to be sure we're getting one row.
$sql = "SELECT something FROM tablename WHERE a = '".$a."' LIMIT 0,1";
// Since we know we're getting a single value, we can use the getRow() method.
$result =& $objDB->getRow($sql);
var_dump($result);
?>
The PHP_mySQL group is dedicated to learn more about the PHP_mySQL web database
possibilities through group learning.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php_mysql/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/