sandy1028 Posted August 27, 2007 Share Posted August 27, 2007 Hi, How to the display 5 columns from 10 columns in a page using for loop reading data from txt file Quote Link to comment https://forums.phpfreaks.com/topic/66824-for-loop/ Share on other sites More sharing options...
teng84 Posted August 27, 2007 Share Posted August 27, 2007 i dont get you but maybe you just have to use the index of that array base on your need if you use array Quote Link to comment https://forums.phpfreaks.com/topic/66824-for-loop/#findComment-335001 Share on other sites More sharing options...
sandy1028 Posted August 27, 2007 Author Share Posted August 27, 2007 foreach($data as $line){ $text_line=explode("|",$line); foreach($text_line as $text){ $tex=explode(":",$text); $rows=count($tex); $col=count($text_line); for($j=0; $j<=count($text_line); $j++){ $output.=$tex[$j].' '; Here I should display only 5 columns which I am not able to do Quote Link to comment https://forums.phpfreaks.com/topic/66824-for-loop/#findComment-335010 Share on other sites More sharing options...
sandy1028 Posted August 27, 2007 Author Share Posted August 27, 2007 function paginateRecords($file,$page){ //Some code foreach($data as $line){ $text_line=explode("|",$line); foreach($text_line as $text){ $tex=explode(":",$text); $output .= $tex[0]; } echo "<td colspan=\"3\">"; ?> <div align="center" class="tduser"><?php echo paginateRecords($file,$page)?> </div></td> The echo prints the array of values in one block itself. How to Display in different columns. Quote Link to comment https://forums.phpfreaks.com/topic/66824-for-loop/#findComment-335043 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.