0

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"; 
             }
           ?>
2
Contributors
4
Replies
10
Views
3 Years
Discussion Span
Last Post by sabarinadh.ch
0

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

Edited by paulkd: incorrect answer

0

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

1

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.