Re: getting field names for key in getOne()

From: Date: Wed, 02 Jun 2004 19:02:54 +0000
Subject: Re: getting field names for key in getOne()
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12844@lists.php.net to get a copy of this message
Hi Clint, Clint Skidmore wrote:
is there any way to get the field name as the key when using the getOne() method. I cannot figure it out
Think this should solve your problem: <? $dsn = "mysql://user:pass@localhost/db"; $db =& DB::connect($dsn); if (DB::isError($db)) {
    die($db->getMessage());
} //////////// $db->setFetchMode(DB_FETCHMODE_ASSOC); //////////// $result = $db->getOne("SELECT * FROM user WHERE email=".$db->quoteSmart($_POST['email'])." AND password='".md5($_POST['password'])."'"); if ($result['email'] == "test@test.com") { .... Hope this helps, Cheers, Tony

« previous php.pear.general (#12844) next »