By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,216 Members | 1,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,216 IT Pros & Developers. It's quick & easy.

PEAR:DB select problem

P: n/a
I have the following function. It checks if a User exists, authenticates
that user based on the provided Password and Username, updates the last
login info, and then returns a filepath to direct the user to.

function login($aArgs) {

if( !$this->_authenticate($aArgs) ) {

catchErr("Can't authenticate User");
return FALSE;
}

$sql = " SELECT
app.admin_app_path
FROM
".PREFIX."_admin_apps app,
".PREFIX."_admin_perms perm
WHERE
app.admin_app_id=perm.admin_app_id AND
perm.admin_user_id=".$this->_iUserId." AND
perm.admin_perm > 0
ORDER BY
app.admin_app_id
LIMIT 0, 1";

if( DB::isError($sPath = $this->_oConn->query($sql)) ) {

catchExc($sPath->getMessage());
return FALSE;
}

if( empty($sPath) ) {

catchErr("No acceptable application permissions");
return FALSE;
}

$this->_updateLogin();
return $sPath;
}
my problem is the following. the returned $sPath var doesn't contain the
path, but merely a string saying "Object".
any ideas on this?

thanks a lot in advance,
Bernhard
Jul 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Bernhard Hrlberger wrote:

[snip]
if( DB::isError($sPath = $this->_oConn->query($sql)) ) { [snip] my problem is the following. the returned $sPath var doesn't contain the
path, but merely a string saying "Object".


query() returns a result set object:

<URL:http://pear.php.net/manual/en/package.database.db.db-common.query.php>

You then use this object to loop over the records returned by the select.
It sounds like you want to use one of the shortcut functions, perhaps
getOne()?

if( DB::isError($sPath = $this->_oConn->getOne($sql)) ) {

<URL:http://pear.php.net/manual/en/package.database.db.db-common.getone.php>
--
Jim Dabell

Jul 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.