Check if is query last in PDO FETCH PHP? -
how can check if fetched elem lastly of pdo fetch element in while loop?
example:
while($row=$result->fetch(pdo::fetch_assoc)){ if($row==[lastofpdorow]) echo 'last of rows'; }
thanks helps
this should work you:
<?php $rowcount = 0; while($row = $result->fetch(pdo::fetch_assoc)){ $rowcount++; if($rowcount == $result->rowcount()) echo 'last of rows'; } ?>
php pdo
No comments:
Post a Comment