Move Previous record in php.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thenndral
Forum Newbie
Posts: 20
Joined: Wed Sep 29, 2010 8:36 pm

Move Previous record in php.

Post by thenndral »

Hello,

I'm fetching the data from db

Code: Select all

, I want to moveprevious record. how can i make it in php.

ex,
[syntax=php]$qry  =" SELECT ci.info_dt, ci.iType	FROM tbl_get_info AS ci";
$this->res = $this->query($qry);


if ( $this->getCount() > 0 ) {
$cnt1 = 0;
while($read_data = ($this->fetchonce($this->res))) {
		$site_cd = $read_data['iType'];
		$info_date= $read_data['info_dt'];

if ( ($cnt1 > 0 and $bak_info_date <> $info_date ) or ($cnt1+1) == $record_count ) {

//here i want to use moveprevious record.
// some code
}

}
$cnt1++;
bak_info_date  = $read_data['info_dt'];
}

[/syntax]
Thanks in advance,
Thenndral
Last edited by Benjamin on Tue Dec 28, 2010 3:56 am, edited 1 time in total.
Reason: Added [syntax=php] tags.
anantha
Forum Commoner
Posts: 59
Joined: Thu Dec 23, 2010 7:38 pm

Re: Move Previous record in php.

Post by anantha »

first i could not understand where to move your record...next thing $cnt1++ increment doesn't seem to work...even though you increment..when it goes to the loop again $cnt1 is initialized to 0 again..
Post Reply