note 81419 added to function.PDOStatement-rowCount

From: Date: Wed, 27 Feb 2008 13:43:17 +0000
Subject: note 81419 added to function.PDOStatement-rowCount
Groups: php.notes 
Request: Send a blank email to php-notes+get-136526@lists.php.net to get a copy of this message
For SELECT what you want is: <?php $rows = $statement->fetchAll(); $count = count($rows); ?> This will work with every database and has almost no overhead if you wanted to fetch all rows anyway. $statement->rowCount() can only count rows in buferred queries, which means it does exactly what the code above, but you don't see it :) ---- Server IP: 92.48.74.199 Probable Submitter: 82.70.200.181 ---- Manual Page -- http://www.php.net/manual/en/function.PDOStatement-rowCount.php Edit -- https://master.php.net/note/edit/81419 Del: integrated -- https://master.php.net/note/delete/81419/integrated Del: useless -- https://master.php.net/note/delete/81419/useless Del: bad code -- https://master.php.net/note/delete/81419/bad+code Del: spam -- https://master.php.net/note/delete/81419/spam Del: non-english -- https://master.php.net/note/delete/81419/non-english Del: in docs -- https://master.php.net/note/delete/81419/in+docs Del: other reasons-- https://master.php.net/note/delete/81419 Reject -- https://master.php.net/note/reject/81419 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#136526) next »