I need to somehow figure the total characters in the mysql row "content" and check to see if the character is over the limit. If it is, then the row is reduced to the set maximum characters and the if is true meaning the rest will excucute. If it is not over the character limit then it excucutes normally.
My main questions on what I do not know how is as followed
How do I find out the number of characters in the field "content" to compare to my set number?
How do I set a variable as a character limit so that I can compare the field "content" to this variable?
How do I display the "content" field if in fact is is greater than my set limit?
Below is a snippet of kind of what I want to do. I definitely appreciate any help you can provide.
$sql = "SELECT * FROM articles ORDER BY articleID DESC LIMIT 5";
$result = mysql_query($sql);
if( mysql_num_rows($result) == 0 ) echo'';
else
{
while( $row = mysql_fetch_array($result) )
{
if ($contentlength <= $row['content']) {
echo '<p class="plaintext">' . stripslashes($row['content']) . '...</p>';
echo '<p class="plaintext">For the full article visit';
echo '<a href="/articles.php?id=' . $row['articleid'] . '"class="rightmenuitemhere">';
echo 'The full article </a>'; }
ELSE {
echo '<p class="plaintext">' . stripslashes($row['content']) . '</p>';}
//print article
}
}