"; for ($a = 0; $a < 5; $a++): echo ""; endfor; print ""; endfor;

currently just loops the first set of 5 records returned based on the number of rows used. Is there a way for this to actually return the proper results with the right loopthrough (e.g. 2nd runthrough by for() returns the 2nd set of 5 results)?

EDIT: Solved;

for ($a = 0; $a < 5; $a++):
	$num = $i*5+$a;
	echo "
"; endfor;

fixed everything. Thanks '[info]'olithered!

Source: http://community.livejournal.com/php/460821.html

    for loop question

    Date: 06/18/06 (PHP Community)    Keywords: no keywords

    Ok, I'm writing a script that reads out values from a text file and prints 5 per row. What I've currently got:

    $patches = array();
    while(!feof($fp)):
    	$patch = fgetcsv($fp, 4096);
    	
    	for ($i = 0; $i < 1; $i++):
    		$patches[] = $patch[0];
    	endfor;
    endwhile;
    
    // let's now loop for every 5 records
    
    $numpatch = count($patches);
    $numpatch = ceil($numpatch/5);
    
    for ($i = 0; $i < $numpatch; $i++):
    	print "
$patches[$a]
$patches[$num]
« Serving files to users… || someone help me please?? »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home