limiting field extraction to 40 characters

From: Date: Wed, 11 Dec 2002 17:16:08 +0000
Subject: limiting field extraction to 40 characters
Groups: php.db 
Request: Send a blank email to php-db+get-24076@lists.php.net to get a copy of this message
I am using <? $result = mysql_query("SELECT * FROM courses",$db); printf("<select name=\"coursecode\">\n"); while ($myrow = mysql_fetch_array($result)) { $l=$myrow['coursecode']; ?><option value="<?=$l;?>"<?=($_POST['coursecode']==$l)?' selected="selected"':"";?>><?=$myrow['title'];?></option><? } printf("</select>\n"); ?> to generate a html <option><select>. Unfortunately a few of my course titles are really long and this effects the rendering of the <option><select> making it ultra wide. Is there a way i can print only the first 40 characters of the title - even though the full title lives in the db still (it is used throughout the site)? cheers -- Mike Karthauser Managing Director - Brightstorm Ltd Email >> mikek@brightstorm.co.uk Web >> http://www.brightstorm.co.uk Tel >> 0117 9426653 (office) 07939 252144 (mobile) Snailmail >> Unit 8, 14 King Square, Bristol BS2 8JJ

« previous php.db (#24076) next »