Hello yall! I'm having a bit of a hard time, and this is proberbally the easyiest thing ever created buy how do i word wrap???

I have a tag board and if sum one posts like 'llllllllllllllllll' a really long one, it makes my page all bigifyed, and i want to word wrap it to like 10, do you know how i can do this, and where do i apply it???

    Ok, i had alook, but i want mine to wordwrap a tag board. When i input the tag board on my site, without IFrames i want to make it so that it does sut them donw, but the eg shown o php.net is sorta telling me to put in the words and then the word wrap. If i do that then maybe it would do it but if i put the whole code inside the txt bit, would it work???

      Well yes.. But to make it neater we usually put the whole text in a variable..

      like this

      $text = "The quick brown fox jumped over the lazy dog.";
      $newtext = wordwrap( $text, 20 );
      

      Should parse something like this

      The quick brown fox
      jumped over the lazy dog.

        Ok to make it simpler for me, prob hard fr you, or easy, i have thisscript...

        <?php
        include('mysite/config.php');
        //connects to the database
        $c=mysql_connect("localhost","$dbuser","$dbpass");
        //selects database
        mysql_select_db($dbname);
        //selects the data from database and lists the data
        $todo='SELECT * FROM tagboard order by date desc';
        $solution=mysql_query($todo);
        while ($place = mysql_fetch_array($solution))
        {
        $id=$place["id"];
        $url=$place["url"];
        $name=$place["name"];
        $comments=$place["comments"];
        //tells how the entries will be displayed on the page
        echo"<table><tr><td>Posted by <a HREF=$url>$name</a> <br> $comments<br><hr></td></tr></table>";
        }?>

        Niow thats my lil output for my tg-board, i want the word war to go aroudnd the '$comments' but everytime i do, it, it fails. Can you stil help me? Its the echo, bit i tried to edit it, thats wut is outputted. (you already know, cuz ur a brain box!)

          Dam, i want the word wrap script to go into that script and make the '$comments' all be word wrapped when they get outputted by my server. How baout now?

            I made this...

            <?php
            include('/usr/local/psa/home/vhosts/neoboffins.com/httpdocs/site/tag/config.php');
            //connects to the database
            $c=mysql_connect("localhost","$dbuser","$dbpass");
            //selects database
            mysql_select_db($dbname);
            //selects the data from database and lists the data
            $todo='SELECT * FROM tagboard order by date desc';
            $solution=mysql_query($todo);
            while ($place = mysql_fetch_array($solution))
            {
            $id=$place["id"];
            $url=$place["url"];
            $name=$place["name"];
            $comments=$place["comments"];
            //tells how the entries will be displayed on the page
            echo"<table><tr><td>Posted by <a HREF=$url>$name</a> <br> $text = "$comments";
            $newtext = wordwrap( $text, 8, "\n", 1);
            echo "$newtext\n" <br><hr></td></tr></table>";
            }?>

            Obviously it does not work. I want the word wrap to word wrap the comments outputted. so i tried this...

            <table><tr><td>Posted by <a HREF=$url>$name</a> <br> $text = "$comments";
            $newtext = wordwrap( $text, 8, "\n", 1);
            echo "$newtext\n" <br><hr></td></tr></table>

            That gets echoed but it doesnt work. HELP ME!

              I can see your a real newbie.

              What i showed you was an example.

              Your gonna wanna change $text to $comments

                So, can you like take my eg, and edit it plzzzz. Yeah i am a n00b! AND PROUD!

                  Still not working. Maybe it was not meant to be =(

                    Lets see what you have.

                    By looking at your last example you showed. I dont think you changed the variables over to make sure they echo it out.

                      So what do i need to change? Or can you just make al the code fit right?

                        Write a Reply...