Re: I only want x number of lines of data

From: Date: Wed, 09 Aug 2006 14:44:12 +0000
Subject: Re: I only want x number of lines of data
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-240374@lists.php.net to get a copy of this message
Ross wrote:
At the mometn I have this function display_result($module_no) { $count = 0; //Of course you *should* initialize $count
$start = 1; $end = 3;
if ($module_no != "") { $module_no =unserialize ($module_no); foreach ($module_no as $number => $data) { $count=$count+1; if( $count >= $start && $count <= $end ) { ?>
Q.<?=$count; ?>- <span style="font-weight:bold"><?=$data;?></span><BR /> <? }
} } which outputs all the data in the array..typically.. Q.1- pass Q.2- pass Q.3- pass Q.4- pass Q.5- pass but what if i only want q1-q3 output? any ideas how I can modify the script to give me x number of outputted answers?


« previous php.general (#240374) next »