Greaser9780 Posted February 15, 2007 Share Posted February 15, 2007 How would I even go about this.I figured out the query and how to list my array. I would like to create a table visible to users that displays my array. I would also like it to automatically set the number of rows by the number of clan names in that database. Quote Link to comment Share on other sites More sharing options...
JJohnsenDK Posted February 15, 2007 Share Posted February 15, 2007 Where do you pull the clan names from? database or do you just type them in a array? If database do something like this: <table> <?php $result = mysql_query("SELECT name FROM clans"); while($row = mysql_fetch_array($result)){ echo "<tr><td>'$row['name']'</td></tr>"; } ?> </table> If in array use a foreach loop... Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted February 15, 2007 Author Share Posted February 15, 2007 Here is my code where I pull it up from the db in an array: $sql="SELECT `clan_name`,`wins`,`losses`,`message`,`clan_id`,`link` FROM `bhdsingle` ORDER BY `wins` DESC"; $res=mysql_query($sql) or die(mysqll_error()); while ($list = mysql_fetch_array($res)) { $clan_name = $list["clan_name"]; $wins = $list["wins"]; $losses = $list["losses"]; $message =$list["message"]; $clan_id = $list["clan_id"]; $link = $list["link"]; } Quote Link to comment Share on other sites More sharing options...
New Coder Posted February 15, 2007 Share Posted February 15, 2007 $sql="SELECT `clan_name`,`wins`,`losses`,`message`,`clan_id`,`link` FROM `bhdsingle` ORDER BY `wins` DESC"; $res=mysql_query($sql) or die(mysqll_error()); while ($row = mysql_fetch_array($res)) { $list = "<table>"; $list .= "<tr>"; $list .= "<th>Clan Name</th>"; $list .= "<td>".$row["clan_name"]."</td>"; $list .= "<tr>"; $list .= "</table>"; echo( $list ); } Add more columns etc to suit when you know how you want table displayed Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted February 15, 2007 Author Share Posted February 15, 2007 thank you for pointing me in the right direction. Definitely going to have to fiddle with it for awhile. I have 5-6 items to be used as table data. So if I wanted to display "clanname"-"wins"-"losses" I would need to set up a new while statement for each set of table data. Quote Link to comment 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.