Limiting chars for a content
<p>I have content, in which I'm trying to limit using this query: </p>

<pre><code>if(strlen($news_content &lt; 35)){
         $news_content = substr($news_content, 0, 30) . "";
    }
</code></pre>

<p>But for some reason, it isn't limiting the chars.. Or It's my coding(which I'm sure is why it's not working) that's off a bit. </p>

<p>here's the full code: </p>

<pre><code>&lt;?php

    $amount_get = mysql_query("SELECT * FROM comment WHERE articleid='" . mysql_real_escape_string($_GET['id']) . "'"); 
    $comments = mysql_num_rows($amount_get);            

    $grab = mysql_query("SELECT * FROM articles WHERE id='" . mysql_real_escape_string($_GET['id']) . "' LIMIT 1");    
    $grab = mysql_query("SELECT id, news_title, news_content, news_author, news_day, news_month, news_year, news_date FROM articles ORDER BY id DESC limit 3"); 
    $news_day =$row['news_day'];
    $news_month =$row['news_month'];
    $news_year =$row['news_year'];
    $news_content =$row['news_content'];

    if(strlen($news_content &lt; 35)){
                        $news_content = substr($news_content, 0, 30) . "";
                    } 

    elseif (mysql_num_rows($grab)==0) {
    echo "&lt;div class='alert alert-note-x'&gt;Sorry, it looks like their are no articles posted!&lt;/div&gt;";
}
    while($row = mysql_fetch_array($grab)){

?&gt;

&lt;div class="post-container"&gt;
    &lt;div class="post"&gt;
    &lt;div class="left"&gt;
    &lt;div class="date"&gt;&lt;span class="day"&gt;&lt;?php echo $row['news_day'] ?&gt;&lt;/span&gt; &lt;span class="month"&gt;&lt;?php echo $row['news_month'] ?&gt;&lt;/span&gt; &lt;span class="year"&gt;&lt;?php echo $row['news_year'] ?&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;div class="postcontent"&gt;&lt;h5 class="posttitle"&gt;&lt;a href="#/media/&lt;?php echo $row['id'] ?&gt;.&lt;?php echo stripslashes(str_replace(" ", "-", $row['news_title'])); ?&gt;"&gt;&lt;?php echo stripslashes($row['news_title']); ?&gt;&lt;/a&gt;&lt;/h5&gt;                       

        &lt;?php echo $row['news_content'] ?&gt;
        &lt;p&gt; (READ MORE)&lt;/p&gt;
        &lt;p&gt;Comments (&lt;?php echo $comments ?&gt;)&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;​
&lt;/div&gt;  
</code></pre>

  

<p>I'm simply trying to limit the "news_content", but I don't know where it is that I'm messing up at. Thanks! </p>
