Re: Need some help, Thanks

From: Date: Fri, 03 Sep 2004 12:44:59 +0000
Subject: Re: Need some help, Thanks
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14388@lists.php.net to get a copy of this message
Chris Ilias wrote:
David Kahn wrote:
$check = $db_object->query("SELECT user_name, passw FROM users WHERE user_name = '".$_POST['uname']."'"); There is no problem, However when I need to get an attribute from that query such as:
                        $info = $check->fetchRow();
 I get errors. It does not store a proper answer into the variable $info,
rather it just stores the word "Object".
try to display the variable with var_dump() like: var_dump($info);
var_dump is a good idea but what probably happened is you had a query error (($_POST['uname'] is empty, bad column names etc...). Check that $check is not a PEAR_Error. If the $db_object->query() fails for some reason it returns an error object. Try this: if (DB::isError($check)) { echo $check->getMessage(); exit; // or die or return false or whatever } else { $info = $check->fetchRow(); ... } Scott Mattocks

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