Jump to content

[SOLVED] how to change line


beboo002

Recommended Posts

hello all

how i am change line while record fetch through database if record is too long

 

my code is here

 

$sql5="select * from comments where cat_id=0 limit 2";

$res5=mysql_query($sql5,$link);//$query=mysql_fetch_row($res);

echo "<table width=694 cellpadding=0 cellspacing=0 border=1>";

while ($row5=mysql_fetch_array($res5))

{

echo "<tr><td width=500>$row5[text1]</td><br>";

echo "<td width=500></td></tr>";

}echo "</table>";

Link to comment
Share on other sites

I have a text field in my table where data store is too long in length when i am disply in localhost its show in one line.

 

I am fetching some content frm databse and displaying it on my webpage. Now the problem is the content is displayed in one single line and not according to the size of the page. I want that the content of the page should be displayed according to the width of the page.

Link to comment
Share on other sites

as above i am said that i hav a text field in my database the column name is text1 and in text one field there is only single entry of 5oo words now when i fetch the record in my database it showing in single line in my web page

now i need that count of every 100 word or (width of webpage ) it should be line change

 

let take a example my record show some thing like this

-------------------------------------------------------------------------------------------------

Its still a little difficult to understand your ramblings. Maybe the nl2br function is what your looking for.

----------------------------------------------------------------------------------------------------

now i want to display record some thing like this

----------------------------------------------------------------------------------------------------

Its still a little difficult to understand

your ramblings. Maybe the nl2br

function is what your looking for.

Link to comment
Share on other sites

thanks for reply

its working but a new problem arise that this code not change line for next database records

here my code is

-----------------------------------------------------------------------------------------

while ($row5=mysql_fetch_array($res5))

{

$text2="<tr>$row5[text1]</tr>";

$newtext = wordwrap($text2, 20, "<tr><br /></tr>\n");

 

echo $text2;

//echo "<tr><td width=500>$row5[text1]</td><br>";

 

}echo "</table>";

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.