Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WordWrap Problem

Status
Not open for further replies.

gokeeffe

Programmer
Jan 11, 2005
170
IE
Hi

Could anyone advice me on how to add the wordwrap function to the following code so that I can set limits for the rows in my table

Tks in advance






echo '<table align="center" cellspacing="2" cellpadding="2">
<tr>
<td class="labelcell3"><b>Grind No</b></td>
<td class="labelcell3"><b>Exam</b></td>
<td class="labelcell3"><b>Subject</b></td>
<td class="labelcell3"><b>Level</b></td>
<td class="labelcell3"><b>County</b></td>
<td class="labelcell3"><b>Town/Region</b></td>
<td class="labelcell3"><b>Extra Location Details</b></td>
<td class="labelcell3"><b>Contact Name</b></td>
<td class="labelcell3"><b>Contact Number</b></td>
</tr>';
// Fetch and print all the records
while ($row = mysql_fetch_array($result,MYSQL_NUM))
{
echo "<tr>
<td class=\"fieldcell3\">FG$row[0]</td>
<td class=\"fieldcell3\">$row[1]</td>
<td class=\"fieldcell3\">$row[2]</td>
<td class=\"fieldcell3\">$row[3]</td>
<td class=\"fieldcell3\">$row[4]</td>
<td class=\"fieldcell3\">$row[5]</td>
<td class=\"fieldcell3\">$row[6]</td>
<td class=\"fieldcell3\">$row[7]</td>
<td class=\"fieldcell3\">$row[8]</td>
</tr>\n";
 
i guess,
one way is to check the length of each record and then assigning line break.
for e.g. create a function for each input
function check_length($length)
{
if (strlen($length) > 10){
//do a substr() here
//and put the two codes
}else {
return "<td class=\"fieldcell3\">FG$row[0]</td>";
}
}

ko12
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top