Re: [PHP] formating output
print "\n"; print "\n"; $counter = 0; while ($result = mysql_fetch_array($pointer)) { $counter++; if ($counter % 4 === 0) { print "".$result[1]."\n"; print "\n"; print "\n"; } else { print "".$result[1]."\n"; } } // add blank cells if number of cell on last row isn'4 four. for ($i = 0; $i < $counter % 4; $i++) { print " \n"; } print "\n"; print "\n"; - Larry L wrote: I'm sure this is easy and I'll feel silly when I see how it's done, but, my mnd is a blank, this structure prints out a table with a new row for each item <$results[1] " ; } ?> what I want to do is print out a table 4 columns wide and however many rows high needed to run through the data HOW do I loop through the array and get data printed 4 times then a new row started and then 4 more cells printed, etc thank you in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] formating output
[snip] this structure prints out a table with a new row for each item <$results[1] " ; } ?> what I want to do is print out a table 4 columns wide and however many rows high needed to run through the data HOW do I loop through the array and get data printed 4 times then a new row started and then 4 more cells printed, etc [/snip] Is the data all in one row in the database? \n; for($i = 0; $i < count($results); $i++){ if(0 = $i%4){ print "" . $results[$i] . "\n\n\n"; } else { print "" . $results[$i] . "\n"; } } print ""; ?> NOT TESTED and may give too many tags. You'll need to test for total data cells returned -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] formating output
I'm sure this is easy and I'll feel silly when I see how it's done, but, my mnd is a blank, this structure prints out a table with a new row for each item <$results[1] " ; } ?> what I want to do is print out a table 4 columns wide and however many rows high needed to run through the data HOW do I loop through the array and get data printed 4 times then a new row started and then 4 more cells printed, etc thank you in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formating output
some code snipits would help, but lets see what we can do. I like arrays, they work for me, there are lots of ways todo things, arrays will help. echo "{$headline[0]}Latest news blah blah \n"; echo "{$headline[1]}Latest news blah blah \n"; echo "{$headline[2]}Latest news blah blah \n"; you can also accompish this nicer with a foreach loop foreach($headline as $pos => $val) echo "{$headline[$pos]}Latest news blah blah \n"; more info at http://php.net/manual/en/control-structures.foreach.php email me with more questions, I am eager to help -- Chris Lee Mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 [EMAIL PROTECTED] ""george"" <[EMAIL PROTECTED]> wrote in message 97j42g$314$[EMAIL PROTECTED]">news:97j42g$314$[EMAIL PROTECTED]... I am developing a site which will have a web based admin panel, just now you can alter the scrolling headlines through the panel. But I want to be able to let the user modify, delete and create new headline, this isnt proble but i dong know how to format the output. What i want is for it to dispaly the headlines that are in the table be it 2 or 5 how do i take info from a table and get it to echo the code as many times as needed(dependingon the headlines in the table) so the code would be like this but how do i also stop it from displaying the same fields ie exact same headline link etc. and how do i get this so that 3 news stories = 3 lines code myScroller1.addItem(" latest news news, news news news"); Hope you understand it, I dont think i do. George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] formating output
I am developing a site which will have a web based admin panel, just now you can alter the scrolling headlines through the panel. But I want to be able to let the user modify, delete and create new headline, this isnt proble but i dong know how to format the output. What i want is for it to dispaly the headlines that are in the table be it 2 or 5 how do i take info from a table and get it to echo the code as many times as needed(dependingon the headlines in the table) so the code would be like this but how do i also stop it from displaying the same fields ie exact same headline link etc. and how do i get this so that 3 news stories = 3 lines code myScroller1.addItem(" latest news news, news news news"); Hope you understand it, I dont think i do. George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]