Basically I'm making a database for my games collection, got data submitting, sorting by letter, and displaying all nice looking. Only problem is the formatting.
Currently you can see it's one single column list. I want it to be a two column list, like this:
A | B
C | D
E | F
G |H
So basically the code goes "right, Chu Chu Rocket & Cosmic Smash in row one, then Crazy Taxi and Crazy Taxi 2 in the next row, etc etc...
Here is my code:
How could I rewrite it so the PHP outputs it correctly? I've tried making tables to contian it, etc, but it won't work.
Mark
Currently you can see it's one single column list. I want it to be a two column list, like this:
A | B
C | D
E | F
G |H
So basically the code goes "right, Chu Chu Rocket & Cosmic Smash in row one, then Crazy Taxi and Crazy Taxi 2 in the next row, etc etc...
Here is my code:
Code:
<table width="550" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="31" background="images/content_top.gif"><table width="530" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td class="style1">Dreamcast Software Collection </td> </tr> </table></td> </tr> <tr> <td bgcolor="#E4E4E4"><table width="530" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><div align="center">Please select a letter: <br> [0] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] <br> [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] </div></td> </tr> </table></td> </tr> <tr> <td><img src="images/content_base.gif" width="550" height="15" /></td> </tr> </table> <br><? $username="*********"; $password="*********"; $database="MySega"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM dreamcast WHERE title LIKE 'C%'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $title=mysql_result($result,$i,"title"); $developer=mysql_result($result,$i,"developer"); $year=mysql_result($result,$i,"year"); $region=mysql_result($result,$i,"region"); $condition=mysql_result($result,$i,"condition"); $rating=mysql_result($result,$i,"rating"); $boxart=mysql_result($result,$i,"boxart"); $notes=mysql_result($result,$i,"notes"); echo "<table width='270' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='270' height='16' align='center' background='http://www.mysega.co.uk/images/db_top_title.gif'>$title</td> </tr> <tr> <td width='270' height='119' background='http://www.mysega.co.uk/images/db_back_info.gif'><table width='254' height='102' border='0' align='center' cellpadding='0' cellspacing='0'> <tr> <td width='102' height='102' align='center'><table border='0' cellpadding='0' cellspacing='1' bgcolor='#000000'> <tr> <td><img src='http://www.mysega.co.uk$boxart' /></td> </tr> </table></td> <td width='7' align='right'> </td> <td width='145' valign='top'><table width='145' height='102' border='0' cellpadding='0' cellspacing='0'> <tr> <td align='left'><img src='http://www.mysega.co.uk/images/db_regionbt.gif' width='68' height='7' /></td> </tr> <tr> <td><table width='145' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='50'><img src='http://www.mysega.co.uk/images/db_$region.gif' width='26' height='15' /></td> <td width='95'>$developer</td> </tr> </table></td> </tr> <tr> <td><img src='http://www.mysega.co.uk/images/db_yearcondition.gif' width='139' height='11' /></td> </tr> <tr> <td height='12'><table width='145' height='12' border='0' cellpadding='0' cellspacing='0'> <tr> <td width='50' class='SmallFontDark'>$year</td> <td width='95'><img src='http://www.mysega.co.uk/images/db_$condition.gif' width='55' height='10' /></td> </tr> </table></td> </tr> <tr> <td><img src='http://www.mysega.co.uk/images/db_notes.gif' width='139' height='11' /></td> </tr> <tr> <td height='40' valign='top' class='SmallFontDark'>$notes</td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td width='270'><img src='http://www.mysega.co.uk/images/db_base_$rating.gif' width='270' height='17' /></td> </tr> </table><br>"; $i++; } ?>
Mark
Comment