Jump to content

how to wrap a php echo in a standard cell ?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
rolandsmith

rolandsmith

    Newbie

  • Members
  • Pip
  • 3 posts
Hey guys,

My td width = 378 as you see but I'm getting a few miles long text back from this query. How can I wrap that?

<tr><td bgcolor="#D4D0C8"><strong>References</strong></td>
<td width="378" bgcolor="#FFFFFF"><span class="style2"><strong>
<?php 
$result = mysql_query("select refs from userCV where id='$_SESSION[user_id]'");
$var = mysql_fetch_row($result);
$var = $var[0]; 
echo $var; 
?>
</strong></span>
</td></tr>

Any help would be greatly appreciated!!!

Edited by Jaan, 02 April 2010 - 04:35 AM.
Please use code tags when you are posting your codes!


#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
You can either use PHP: wordwrap - Manual or wrap your text in a <div> and set the style on that element properly.

#3
rolandsmith

rolandsmith

    Newbie

  • Members
  • Pip
  • 3 posts
Thanks so much John!

Problem solved :thumbup1:

just had to insert a line:
$var2 = wordwrap($var, $width=75, $break="<br />", $cut = false);


have a great day

Edited by Jaan, 02 April 2010 - 04:36 AM.
Please use code tags when you are posting your codes!


#4
zeroradius

zeroradius

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,406 posts
Tabels usualy automaticly wrap text. The problem is you did not spesify a unit of measurement make it 300px instead of just 300 and you won't have to use an extra function.
Posted Image

#5
rolandsmith

rolandsmith

    Newbie

  • Members
  • Pip
  • 3 posts
Thanks zeroradius,

You are totally right. I've changed 300 to 300px.
I don't need to use this wordwrap extra function now.

Cheers,

Have a great day!

zeroradius said:

Tabels usualy automaticly wrap text. The problem is you did not spesify a unit of measurement make it 300px instead of just 300 and you won't have to use an extra function.