|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||||
|
|||||
|
PEAR- numRows() problem!
Dear all,
I am quite new to programming in general, and have started using php to create a web application. I am using the PEAR database abstraction layer but have hit a brick wall. The method numRows() is supposed to return a number but keep getting 'Object' instead. Below is part of my code: php Code:
The script returns the following: Object Welcome! ,every time, even when the username does not exist in the database. I have been tearing out my hair for the past week. I would appreciate any help anybody could give. Yours, Koy |
|
#2
|
|||
|
|||
|
RE: PEAR- numRows() problem!
Can I see the numRows() function?
|
|
#3
|
|||
|
|||
|
RE: PEAR- numRows() problem!
numRows() is a PEAR DB method. I didn't create this method. Like your gundam icon by the way!
|
|
#6
|
|||
|
|||
|
RE: PEAR- numRows() problem!
Yes, it is like mysql_num_rows but I am using the PEAR DB abstraction layer. Has anyone else using PEAR had this problem or know how to solve it?
|
|
#7
|
|||
|
|||
|
RE: PEAR- numRows() problem!
echo $login_query->numRows();
Try not to assign the numRows() function to a variable Good Luck |
|
#8
|
|||
|
|||
|
Same Issue
Koy, did you ever find a solutions to this, I'm running into the same issue.
|
|
#9
|
|||
|
|||
|
RE: PEAR- numRows() problem!
|
|
#10
|
|||
|
|||
|
RE: PEAR- numRows() problem!
|
|
#11
|
|||
|
|||
|
RE: PEAR- numRows() problem!
suggest you look at your sql because that should work fine ive just tried it myself and it does. you some times get funny errors with pear if your sql isnt correct
|
|
#12
|
|||
|
|||
|
RE: PEAR- numRows() problem!
in php, especially when you are new to a set of functions... print_r($var) can be your friend... this takes whatever $var is and prints it out the the screen for you to visually inspect.. if you are not getting what you thought try print_r-ing it and you should be able to get a handle on just what that thing is.. print_r shows in ascii not html so wrap with <pre> tags to get the correct line breaks seen
print "<pre>"; print_r($thing); print "</pre>"; |
|
#13
|
|||
|
|||
|
RE: PEAR- numRows() problem!
I ran into same issue. I found that I could get it to work if I changed my SQL statements to "select DISTINCT colname from table". Not sure what adding the DISTINCT did but it fixed my problem.
|
|
#14
|
|||
|
|||
|
RE: PEAR- numRows() problem!
This code fixed my problem.
php: -------------------------------------------------------------------------------- $res =& $db->query($req); $db->setOption('portability', DB_PORTABILITY_NUMROWS); echo $res->numRows(); ?> |