illuz1on Posted March 14, 2007 Share Posted March 14, 2007 Hey Im trying to echo some things into a table from mysql database, and its in a while loop. This is how im echoing the table code but it doesnt come out so nicely, really wish it did been trying forever, and tuts arent helping. It comes out all distorted and not looking so good, is there a better way to be doing tables? http://www.capetownalive.co.za/viewdetails.php?id=7 echo "<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#999999\" id=\"Table_01\">"; echo "<tr>"; echo "<td colspan=\"2\">$name -- $rating </td>"; echo "<td width=\"320\" rowspan=\"2\">$picture</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"2\">$sdesc</td>"; echo "</tr>"; echo "<tr>"; echo "<td width=\"191\" rowspan=\"4\" valign=\"top\"><table width=\"100%\" border=\"0\">"; echo "<tr>"; echo "<td height=\"149\">$picture</td>"; echo "</tr>"; echo "<tr>"; echo "<td height=\"149\">$picture2</td>"; echo "</tr>"; echo "</table></td>"; echo "<td colspan=\"2\"><div align=\"center\" class=\"style1\">USEFUL INFO </div></td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"2\"><p><strong>SURFING</strong>: $surfing </p> </td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"2\"><strong>DIRECTIONS: </strong>$directions </td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"2\" bordercolor=\"#333333\">$ldesc</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"2\"><span class=\"style2\">send to a friend || print this page </span></td>"; echo "<td><span class=\"style2\">more details | view gallery | map</span> </td>"; echo "</tr>"; echo "</table>"; Quote Link to comment Share on other sites More sharing options...
monk.e.boy Posted March 14, 2007 Share Posted March 14, 2007 first thing would be to replace: echo "<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#999999\" id=\"Table_01\">"; with: echo '<table border="1" cellpadding="0" cellspacing="0" bordercolor="#999999" id="Table_01">'; and now look up in google rowspan and colspan. That's where your problems are I think. rowspan spans 'n' rows. colspan spans 'n' columns. Now take a sheet of paper and draw the table. (<<--- DON'T SKIP THIS STEP!!!!) Now translate the picture into HTML. I'd imagine you will have no colspans or rowspans. No hack the HTML into your PHP script. monk.e.boy Quote Link to comment Share on other sites More sharing options...
aebstract Posted March 14, 2007 Share Posted March 14, 2007 Also, no need to echo each line individually, you can just echo once and put all of that information in to one. echo 'blal blala blalb allal alalal ala lalaaaaaaa'; Quote Link to comment Share on other sites More sharing options...
mfindlay Posted March 14, 2007 Share Posted March 14, 2007 I would do away with the table and use divs!! much better Quote Link to comment Share on other sites More sharing options...
monk.e.boy Posted March 14, 2007 Share Posted March 14, 2007 I would do away with the table and use divs!! much better Nah, divs have their place, but showing tabular data from a db is not one of them. Keep using tables. monk.e.boy 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.