beboo002 Posted September 6, 2007 Share Posted September 6, 2007 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>"; Quote Link to comment https://forums.phpfreaks.com/topic/68213-solved-how-to-change-line/ Share on other sites More sharing options...
xyn Posted September 6, 2007 Share Posted September 6, 2007 explain in more detail? Quote Link to comment https://forums.phpfreaks.com/topic/68213-solved-how-to-change-line/#findComment-342934 Share on other sites More sharing options...
beboo002 Posted September 6, 2007 Author Share Posted September 6, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/68213-solved-how-to-change-line/#findComment-342937 Share on other sites More sharing options...
beboo002 Posted September 7, 2007 Author Share Posted September 7, 2007 anyone? :'( :'( Quote Link to comment https://forums.phpfreaks.com/topic/68213-solved-how-to-change-line/#findComment-343483 Share on other sites More sharing options...
trq Posted September 7, 2007 Share Posted September 7, 2007 Its still a little difficult to understand your ramblings. Maybe the nl2br function is what your looking for. Otherwise, once again, we need a clear explanation of your problem. Quote Link to comment https://forums.phpfreaks.com/topic/68213-solved-how-to-change-line/#findComment-343485 Share on other sites More sharing options...
beboo002 Posted September 7, 2007 Author Share Posted September 7, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/68213-solved-how-to-change-line/#findComment-343490 Share on other sites More sharing options...
jitesh Posted September 7, 2007 Share Posted September 7, 2007 wordwrap <?php $row5[text1] = "The quick brown fox jumped over the lazy dog."; $newtext = wordwrap($row5[text1], 20, "<br />\n"); echo $newtext; ?> Quote Link to comment https://forums.phpfreaks.com/topic/68213-solved-how-to-change-line/#findComment-343493 Share on other sites More sharing options...
beboo002 Posted September 7, 2007 Author Share Posted September 7, 2007 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>"; Quote Link to comment https://forums.phpfreaks.com/topic/68213-solved-how-to-change-line/#findComment-343500 Share on other sites More sharing options...
jitesh Posted September 7, 2007 Share Posted September 7, 2007 This may be better in your case. while ($row5=mysql_fetch_array($res5)){ $rows_a = array(); $rows_a = str_split($row5[text1],20); foreach($rows_a as $key => $value){ echo "<tr>".$value."</tr>"; } } Quote Link to comment https://forums.phpfreaks.com/topic/68213-solved-how-to-change-line/#findComment-343504 Share on other sites More sharing options...
beboo002 Posted September 7, 2007 Author Share Posted September 7, 2007 thanks jitesh currenty i m working php 4x here str_split function is not working error undefind str_split ()function. Quote Link to comment https://forums.phpfreaks.com/topic/68213-solved-how-to-change-line/#findComment-343507 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.