I want to show only first 50 lines of the $name of the player using string. I used substring but its not work for me. Can anyone edit the code and show only first 50 lines of name. Thanks for the help....

<?php

            include('config.php');

             $tbl_name="players"; // Table name 

             $sql="SELECT * FROM $tbl_name ORDER BY id DESC  LIMIT 0,6";

             $result=mysql_query($sql);

            while($rows=mysql_fetch_array($result)){
              echo "<li><a style=\"text-decoration:none\" href=\"playerslist.php?id=" .$rows['id']. "\">" .$rows['name']. "</a></li>\n"; 
             }
           ?>

echo '<li><a style="text-decoration :none" href="playerslist.php?id='.$rows['id'].'">'.substr($rows['name'],0,50).'</a></li>';

Thanks for the reply paulkd. It shows this error Parse error: syntax error, unexpected '/' in

Hi Sabarinadh,

Did you copy and paste?
Is the error pointing to the line which I supplied?

I have tested it here and all is well.

Thank you paulkd its working :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.