<? while ($row = mysql_fetch_object($result)) { $fldid=$sno=$row->fldid; $fldquestion=$row->fldquestion; $fldtype=$row->fldtype; $fldexaminer=$row->fldexaminer; ?> <tr> <td><?=$sno?></td> <td bgcolor="#FFFFFF"><?=$fldquestion?></td> PHP: Hi, the $fldquestion get from mysql a question.. but some questions are huge how can i show just the first 20 characters from that field?? thankz
As Imozeb suggested use substr(), if you look at the documentation theirs a few useful examples which you can build upon: http://php.net/manual/en/function.substr.php <?php while ($row = mysql_fetch_object($result)) { $fldid=$sno=$row->fldid; $fldquestion=$row->fldquestion; $fldtype=$row->fldtype; $fldexaminer=$row->fldexaminer; ?> <tr> <td><?php echo $sno; ?></td> <td bgcolor="#FFFFFF"><?php echo substr($fldquestion, 0, 20); ?></td> PHP: