DieSucker Posted July 17, 2006 Share Posted July 17, 2006 OK so i have written this script[code]$d = dir("./");while(false !== ($e = $d->read()))if ($e != "." && $e != ".." && $e !="index.php") { $insertFILE = "insert into information2(map_name, map_size) values ('" . $e . "', '" . formatbytes(filesize($e)) . "')"; $resultFILE = mysql_query($insertFILE); echo $e . "\n" . formatbytes(filesize($e)) . "\n" . '<br/>'; }?>[/code]so then the database will look like[code] CTF-BT-YouAreLOL.zip 389 kB CTF-BT-YouAreOnCoke.zip 5.38 MB CTF-BT-Zwielicht-2.zip 546 kB CTF-BT-Zyron.zip 758 kB [/code]I anna read the list into a table, but the table needs to go 3 entries across, doesn't mater how far it goes down, each cell it include the file name and size ie CTF-BT-YouAreLOL.zip(389 kB)I just dont know how to get it to 3 across then end the trany help? Quote Link to comment https://forums.phpfreaks.com/topic/14815-table-making-help/ Share on other sites More sharing options...
cunoodle2 Posted July 17, 2006 Share Posted July 17, 2006 Try this...[code]<?php$d = dir("./");echo "<table>\n <tr>";counter = 0;while(false !== ($e = $d->read()))if ($e != "." && $e != ".." && $e !="index.php") { $insertFILE = "insert into information2(map_name, map_size) values ('" . $e . "', '" . formatbytes(filesize($e)) . "')"; $resultFILE = mysql_query($insertFILE); counter ++; echo $e . " <td>" . formatbytes(filesize($e)) . "</td>\n"; //place a new line in the table after 3 entries if (counter == 3) { counter = 0; echo " </tr>\n <tr>\n"; }}echo " </tr>\n</table>?>[/code]The above will get you started but you will need to do some fine tweeking for like if the last row only has 1 item etc.. in it. Good luck Quote Link to comment https://forums.phpfreaks.com/topic/14815-table-making-help/#findComment-59190 Share on other sites More sharing options...
DieSucker Posted July 17, 2006 Author Share Posted July 17, 2006 you da man cunoodle2 , thanks so much Quote Link to comment https://forums.phpfreaks.com/topic/14815-table-making-help/#findComment-59192 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.