Fallen_angel Posted December 10, 2006 Share Posted December 10, 2006 Hi I need a bit of help with a script I haveI what I basicly want to do is have a short decription pulled from one of my database fields the database field itself can have 10,000 charictors in it , however I only want to return 250 charictors so that it can be used as a description in the bellow search script [code]<?php//Connect To databaseinclude "connect.php";$id = $_GET['id'];//collects Data$data=mysql_query(" SELECT * FROM strains where s_breeder='$id' ")or die(mysql_error());Print "<table class='print_list_alpha' border=0px style=border-bottom:1px;>" ;while ($info= mysql_fetch_array($data) ){Print "<tr><td><img src=./uploads/mini_thumbs/".$info['img']."></td><td><table><tr><td><a href=../guide/report.php?id=".$info['s_id']."><b>".$info['s_name']."</b></a></td><tr><td> ".$info['s_notes'] ."</td></tr></table>";}Print "</table>" ;?>[/code]Thanx to anyone that can help Quote Link to comment Share on other sites More sharing options...
btherl Posted December 11, 2006 Share Posted December 11, 2006 You can list each of your columns seperately, and limit the column you want to limit[code=php:0]SELECT s_id, s_name, SUBSTRING(s_notes FROM 0 FOR 250) AS s_notes FROM strains WHERE s_breeder='$id'[/code] Quote Link to comment Share on other sites More sharing options...
fenway Posted December 15, 2006 Share Posted December 15, 2006 LEFT() works equally well. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.