note 20662 added to control-structures

From: Date: Thu, 11 Apr 2002 18:14:25 +0000
Subject: note 20662 added to control-structures
Groups: php.notes 
Request: Send a blank email to php-notes+get-29122@lists.php.net to get a copy of this message
You can also use this if/else condition structure to control an index navigation page statement and extract partial rows from an array. // Init to control pointer into the array $setlimit = 10; // rows limit $pointer = 0; // this is the start pointer value $next = $pointer + $setlimit; // increment the pointer $prev= $next - $setlimit; // decrement the pointer $total_rows = mysql_num_rows($myrows); // total rows // You're at the beginning if (($pointer == 0) && ($total_rows > $setlimit)): echo"$next >>"; // You're in the middle elseif ($next < $total_rows): echo"<< $prev"; echo"$pointer"; echo"$next >>"; // You're in a selection with only one row elseif (($next == $total_rows) && ($next > $total_rows)): // You're at the end else: echo"<< $prev"; endif; -- http://www.php.net/manual/en/control-structures.php http://master.php.net/manage/user-notes.php?action=edit+20662 http://master.php.net/manage/user-notes.php?action=delete+20662 http://master.php.net/manage/user-notes.php?action=reject+20662

« previous php.notes (#29122) next »