如何使我的段落在一定宽度后转到下一行

So a string is being entered from a database into a paragraph, when the paragraph has spaces the paragraph breaks perfectly but if the string has a word longer than the line it goes off the page as shown below, how can i make it go the the next line instead of off the page?

enter image description here

here is my php and html code:

<div id = "comment">
        <?php
        echo "<div style = 'border-bottom-style: solid;border-bottom-width:1px;'><p class = 'word'>" . $issue . "</p>";
        echo "<p class = 'word info'>" . $author . ' ' . $date . "</p></div>";
        $sql2 = "select * from Ticket_Message where Ticket_Main_id = '$MainId'";
        $query2 = mysqli_query($con,$sql2);
        while ($row = mysqli_fetch_array($query2)){
            $message = $row['message'];
            $auth = $row['auth'];
            $date = $row['date'];
            echo "<div style = 'border-bottom-style: solid; border-bottom-width: 1px;'>";
            echo "<p class = 'word'>" . $message . "</p>";
            echo "<p class = 'word info'>" . $auth . ' ' . $date . "</p>";
            echo "</div>";
        }
        ?>
        </div>

and here is my css attempt to fix it :

p{max-width: 250px;}

basically what i need am trying to do is use css to prevent all paragraphs from extending off the page when the string is longer than the width of the page.

You don't need any php code here.

Use css property word-wrap

p {
    word-wrap: break-word;
    max-width: 250px;
}

Demo: http://www.w3schools.com/cssref/tryit.asp?filename=trycss3_word-wrap