Forum Moderators: coopster

Message Too Old, No Replies

echo <td

         

wkpride

10:39 pm on Jan 24, 2009 (gmt 0)

10+ Year Member



I've stuck with how to control the width of a table...

Here is the example :

echo "<table border='4' width =\"50%\" cellspacing='1' cellpadding='6' bordercolor='#7F25FA'>

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo '<td width="1000">' . $row['email'] . '</td>';
echo "<td>" . $row['gender'] . "</td>";
echo "</tr>";
}
echo "</table>";

If the email is = email@example.com, I don't want to cut off the address, just let it wrap onto another line.

I thought by changing the '<td width ="200">' would cause the variable to shorten & force it onto the next line?

I also tried to adjust the table border % - to shrink everything,,, no good.

Thanks for pointing me in the right direction!

kp

[edited by: eelixduppy at 11:33 pm (utc) on Jan. 24, 2009]
[edit reason] exemplified [/edit]

rob7591

11:44 pm on Jan 24, 2009 (gmt 0)

10+ Year Member



Try adding style=\"word-wrap:break-word;\" in the td. This isn't really a PHP issue, it's more of an HTML/CSS issue.

wkpride

12:25 am on Jan 25, 2009 (gmt 0)

10+ Year Member



Thanks Rob.

I was able to use CSS to adjust the table size & think I'd better do more research on the subject.

Most appreciated

kp