xhtml - php data query returns full database text - limit to 40 characters on news snippet -
i'm building new site client , on index page there latest news div tag. need limit info in text box 50 characters, , have tried mysql left()
function aswell maxlength
in php. i'm not getting results i'm looking for.
<div class="sidebar"> <h3>latest news</h3> <form name="form1" method="post" action=""> <input name="news_title" type="text" value="<?php echo $row_getnews['news_title']; ?>" size="30" maxlength="30"><br /> <textarea name="news_details" cols="25" rows="10" maxlenght="100"><?php echo $row_getnews['news_details']; $str50 = substr($mystring, 0, 50); ?></textarea> <br /> <input name="news_user" type="text" value="<?php echo $row_getnews['news_user']; ?>" size="30" maxlength="30"> </form>
assigning $str50
doesn't make sense:
<textarea name="news_details" cols="25" rows="10" maxlenght="100"><?php echo $row_getnews['news_details']; $str50 = substr($mystring, 0, 50); ?></textarea>
one way echo first 50 characters:
<textarea name="news_details" cols="25" rows="10" maxlenght="100"><?php=substr($row_getnews['news_details'],0,50)?></textarea>
Comments
Post a Comment