|
Posted by Richard Lynch on 05/13/05 03:34
On Thu, May 12, 2005 7:14 pm, Tomás Rodriguez Orta said:
> Hello hard people!!!
> I want to get count rows at the query using odbc over windows.
> but I can't get any value of this, I doing this.
>
> $sql="SELECT * FROM id Like '$id'";
> $res=$db->query($sql);
> $numRecords=$res->numRows();
> echo $numRecords;
>
> but when I the page print $numRecords I saw this Object id #5
As I recall, some ODBC drivers simply don't support a numRows call -- and
they return -1 when they get used...
At a minimum, if you want a good answer, you really need to tell the list
*WHICH* odbc driver you are using, as well as *which* object-oriented
database abstraction layer you are using in your $db variable.
And, finally, what kind of database you are connecting to -- ODBC works
with virtually every database on the planet. Some databases won't support
a numRows() function, or at least not in some circumstances.
Of course, it's also possible that your db abstraction layer in $db
doesn't return an integer of the number of rows from numRows() method, but
returns some kind of object instead, and you need to call a method on that
object to find out the actual number of rows. That would be a pretty
goofy thing to do, but it's possible.
As it stands now, we have nowhere near enough info to help you!
You should also try using var_dump() and printr() on your $numRecords
object to see what structure it has. That alone could tell you what is
going on.
--
Like Music?
http://l-i-e.com/artists.htm
Navigation:
[Reply to this message]
|