futurewii Posted June 27, 2008 Share Posted June 27, 2008 Hey, Im trying to get all the entries from my MySql table to show up here under different tables depending on the "console" value, the value thing works but it only shows one and they all are moved down? any thoughts? Page of Problem... http://www.futurewii.com/?page=videos/index Script... <div id="content"> <h2><span lang="en-gb">Video Database..</span></h2> <br /><br /> <h2>Nintendo Wii</h2> <br /> <table width="400"> <tr style='font-size:12px;' bgcolor="#c0c0c0"> <th>Game Title</th> <th>Video Type</th> <?php include "includes/conn.php"; $query_count = "SELECT * FROM videos WHERE console='wii'"; $rs = mysql_query($query_count) or die("Problem with the query: $query_count<br>" . mysql_error()); $row = mysql_fetch_assoc($rs); { print "<tr style='font-size:12px;'>"; print "<td><a href='?page=videos/view&id=".$row['id']."'>"; echo $row['title']; print "</a></td>"; print"<td>".$row['type']."</td>"; print "</tr>"; } ?> <br /><br /> <h2>Gamecube</h2> <br /> <table width="400"> <tr style='font-size:12px;' bgcolor="#c0c0c0"> <th>Game Title</th> <th>Video Type</th> <?php include "includes/conn.php"; $query_count = "SELECT * FROM videos WHERE console='ngc'"; $rs = mysql_query($query_count) or die("Problem with the query: $query_count<br>" . mysql_error()); $row = mysql_fetch_assoc($rs); { print "<tr style='font-size:12px;'>"; print "<td><a href='?page=videos/view&id=".$row['id']."'>"; echo $row['title']; print "</a></td>"; print"<td>".$row['type']."</td>"; print "</tr>"; } ?> <br /><br /> <h2>Virtual Console</h2> <br /> <table width="400"> <tr style='font-size:12px;' bgcolor="#c0c0c0"> <th>Game Title</th> <th>Video Type</th> <?php include "includes/conn.php"; $query_count = "SELECT * FROM videos WHERE console='vcg'"; $rs = mysql_query($query_count) or die("Problem with the query: $query_count<br>" . mysql_error()); $row = mysql_fetch_assoc($rs); { print "<tr style='font-size:12px;'>"; print "<td><a href='?page=videos/view&id=".$row['id']."'>"; echo $row['title']; print "</a></td>"; print"<td>".$row['type']."</td>"; print "</tr>"; } ?> <br /><br /> <h2>Other Videos</h2> <br /> <table width="400"> <tr style='font-size:12px;' bgcolor="#c0c0c0"> <th>Game Title</th> <th>Video Type</th> <?php include "includes/conn.php"; $query_count = "SELECT * FROM videos WHERE console='oth'"; $rs = mysql_query($query_count) or die("Problem with the query: $query_count<br>" . mysql_error()); $row = mysql_fetch_assoc($rs); { print "<tr style='font-size:12px;'>"; print "<td><a href='?page=videos/view&id=".$row['id']."'>"; echo $row['title']; print "</a></td>"; print"<td>".$row['type']."</td>"; print "</tr>"; } ?> <br /> Link to comment https://forums.phpfreaks.com/topic/112260-solved-table-troubles/ Share on other sites More sharing options...
futurewii Posted June 27, 2008 Author Share Posted June 27, 2008 I fixed the issue of misalignment, forgot to close the table tags :-\:'( But I still cant get it to show all the entries? Link to comment https://forums.phpfreaks.com/topic/112260-solved-table-troubles/#findComment-576356 Share on other sites More sharing options...
darkfreaks Posted June 27, 2008 Share Posted June 27, 2008 your row is totally off try doing something like <?php while($row=mysql_fetch_array) { echo $row['id']; }?> Link to comment https://forums.phpfreaks.com/topic/112260-solved-table-troubles/#findComment-576366 Share on other sites More sharing options...
br0ken Posted June 27, 2008 Share Posted June 27, 2008 while($row = mysql_fetch_assoc($rs)) { print "<tr style='font-size:12px;'>"; print "<td><a href='?page=videos/view&id=".$row['id']."'>"; echo $row['title']; print "</a></td>"; print"<td>".$row['type']."</td>"; print "</tr>"; } You didn't put the code in a loop so it just printed the first result then skipped the next code segment. The above code should work. One more thing, how come you're mixing print and echo statements when they are ultimately the same function (there is a difference but that difference isn't utilised here). Link to comment https://forums.phpfreaks.com/topic/112260-solved-table-troubles/#findComment-576367 Share on other sites More sharing options...
futurewii Posted June 27, 2008 Author Share Posted June 27, 2008 Thanks! It works now Link to comment https://forums.phpfreaks.com/topic/112260-solved-table-troubles/#findComment-576369 Share on other sites More sharing options...
darkfreaks Posted June 27, 2008 Share Posted June 27, 2008 topic solved thanks Link to comment https://forums.phpfreaks.com/topic/112260-solved-table-troubles/#findComment-576370 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.