I have my markup structure as below:
value1
value2
value3
By getting some idea from logic given here I tried following and it works.
'.$rs['value'].'';
if ($icount % 4 == 0 && $icount != $itotal){
echo '';
echo '
That, solved my problem.
Edited: added itotal condition, so when you will have only 4 records per page then also this will work properly.