Jump to content


Show only X many letters PHP

  • Please log in to reply
1 reply to this topic

#1 webdevised

  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 27 September 2006 - 03:07 AM

i have a band show CMS that connects to a DB. in the admin panel I have the code that displays the show venue and with the modify link only.. i don't want the whole venue name displayed all i want is 10 letters of it to be displayed.. can this be done?

this is the admin show view code:
              $db = mysql_connect($dbhost,$dbuser,$dbpass); 
              mysql_select_db($dbname) or die("Cannot connect to database");
              $query = "SELECT * FROM band_shows ORDER BY id"; 
              $result = mysql_query($query);
                echo "<ul>\n";
                while ($r = mysql_fetch_array($result)) {
                  echo "<li><a href=\"admin.php?page=newsmodify&amp;id=$r[id]\">$r[venue]</a></li>\n";
                echo "</ul>\n";


#2 AndyB

  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 27 September 2006 - 03:15 AM

http://ca.php.net/ma...tion.substr.php - the substring function
Legend has it that reading the manual never killed anyone.
My site

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users