Page 1 of 1

Move Previous record in php.

Posted: Tue Dec 28, 2010 12:38 am
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

Re: Move Previous record in php.

Posted: Tue Dec 28, 2010 9:18 am
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..