Jump to content

Output into table, while in a loop


illuz1on

Recommended Posts

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>";

 

Link to comment
https://forums.phpfreaks.com/topic/42665-output-into-table-while-in-a-loop/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.