473,386 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

PEAR:DB select problem

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
1 1986
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: kain | last post by:
hi there, I'm currently converting a MySQL application to PostgreSQL, and I hacked this app to support PEAR::Db . after some good coding days, I've found a problem: mysql_insert_id on pear::db ....
0
by: Analysis&Solutions | last post by:
Greetings: Crack open the beer, PEAR DB 1.6.0 is here! (Hey, I'm a bit giddy with excitement that my intense work during the past seven weeks has come to fruition.) For those unfamiliar with...
0
by: Derek Battams | last post by:
With PHP5RC2, DB::connect() is not returning the correct type of object. #!/usr/local/bin/php <?php require_once("DB.php"); $dsn = "odbc://db2inst1:badpasswd@testdb"; $db =...
3
by: Sven Jacobs | last post by:
Dear newsgroup, I've upgraded to PEAR::DB 1.6.5 recently. Unfortunately now the database connection doesn't work as expected anymore :( The problems seems to be the method disconnect(), which...
3
by: Vincent | last post by:
Hi I have a problem with pear DB my code : for ($i=0;$i<100000;$i) { $sql = "select id from table where id=x";
3
by: scoomey | last post by:
Hi folks- I am currently working on a PHP application which I am using as a personal learning environment for getting a better working understanding about how to tackle application development...
1
by: James | last post by:
Hey everyone, I have a really obscure but impassable problem with a reasonably simple piece of php/PEAR DB/MySQL code When calling several stored procs the first call succeeds, but subsequent...
1
by: Paul | last post by:
I recently upgraded from MySQL 3.23 to 4.1. Now db is not working properly. I'd very much like your help in solving this issue! Here's the code I used to test it: require_once 'DB.php'; $db...
5
by: jmark | last post by:
I need some assistance on how to create a select statement using PEAR DB or MySQL with the LIKE function. That is I am looking of how I can get statement like this work. SELECT * FROM customer...
2
by: daralthus | last post by:
Hello! I would like to ask your help, i have founded a great code here: http://www.jamescaws.co.uk/2008/07/dynamically-count-exit-link-clicks-throughs-using-javascript-php/ but it uses Pear DB...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.