Jump to content

Archived

This topic is now archived and is closed to further replies.

webdevised

Show only X many letters PHP

Recommended Posts

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:
[code=php:0]
<?php
include("config.php");
              $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";
?>
[/code]

thanks....

Share this post


Link to post
Share on other sites
http://ca.php.net/manual/en/function.substr.php - the substring function

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.