Mombu the Php Forum

Go Back   Mombu the Php Forum > Php > PDO Question. Number of rows returned
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 20th November 04:25
stephen-d
External User
 
Posts: 1
Default PDO Question. Number of rows returned



I am switching to PDO and can't find an equivalent to mysql_num_rows.

Am I missing something silly?

Or is there a change of thinking needed for PDO?

How should I determine how many rows a query returned?

Thanks
Stephen
  Reply With Quote


 


2 20th November 04:25
kevin
External User
 
Posts: 1
Default PDO Question. Number of rows returned



PDO returns an array, sizeof/count will get you home

Kevin
http://phpro.org
  Reply With Quote
3 20th November 04:26
stephen-d
External User
 
Posts: 1
Default PDO Question. Number of rows returned


I would like to know how many rows I am working with before starting to
fetch.

Also fetchall, does not seem to have a style that returns each column
value just once. I see this ugly thing in the manual:

Fetch all of the remaining rows in the result set: Array (
[0] => Array (
[NAME] => pear
[0] => pear
[COLOUR] => green
[1] => green )
[1] => Array (
[NAME] => watermelon
[0] => watermelon
[COLOUR] => pink
[1] => pink
)

)

If I could get the column offsets only, without the column names I would be very happy.

Stephen
  Reply With Quote
4 20th November 04:26
phpster
External User
 
Posts: 1
Default PDO Question. Number of rows returned


http://ca3.php.net/manual/en/pdostatement.rowcount.php

--

Bastien

Cat, the other other white meat
  Reply With Quote
5 20th November 04:26
stephen-d
External User
 
Posts: 1
Default PDO Question. Number of rows returned


This is only good for updates, inserts and deletes.<br>

I am just doing a select.
Stephen<br>
  Reply With Quote
6 20th November 04:26
phpster
External User
 
Posts: 1
Default PDO Question. Number of rows returned


my bad.

Note you can change the default return array behaviour by change the
FETCH_STYLE, default is both ordinal and col name

--

Bastien

Cat, the other other white meat
  Reply With Quote
Reply


Thread Tools
Display Modes


Some other forums that might be of your interest : Php 5 forum, Apache forum, Iis forum, Functions forum, Classes forum, Librarys forum, Bugs forum, Postgres forum, Mysql forum, Paradox forum, Ms sql forum, Configurations forum, Php.ini forum, Problems forum, Scripting forum, Css forum, General forums, Off-topic talk, Links, Extra forums, Php


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666