Monday, 15 March 2010

php - How to properly count a query in pdo -



php - How to properly count a query in pdo -

i trying dynamically load more posts scheme

this code...

$stmt = " select * `acmposting` (`sender`='$thisid' , `posttype`='a') or (`recip`='$thisid' , `sender`='$userid' , `posttype`='a') or (`sender` in ($friendsarray) , `recip`='$thisid' , `posttype`='a') order `timesent` desc limit $startlimit,10"; if($stmtcount = $conn->query($stmt)){ if($stmtcount->fetchcolumn() > 0){ $result = acmposts($conn, $site, $userid, $stmt); $jsonarray['a'] = $result; $jsonarray['b'] = 'go'; }else{ $jsonarray['a'] = '<div class="thisoutput" style="padding:12px;">there no more posts</div>'; $jsonarray['b'] = 'stop'; } }

everything works fine until gets lastly set of posts aka if limit 100,10 there 105 posts in phone call won't phone call fetchcolumn().

i hope question makes sense. in advance help can give.

edit

how can determine when have reached limit , deed accordingly

your description not precise maybe looking for:

http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_found-rows

php pdo

No comments:

Post a Comment