Try something like this in your query
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
SELECT substring(FIELD, 1, LENGTH) FROM tableName
[/code]
Where field is the field which stores the data you want to trim and length is the lenght you want returning.
OR
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
SELECT substring(FIELD, 1, round(char_length(FIELD) * 0.10) ) FROM tableName
[/code]
This would return 10% of the data from the cell called FIELD.
Thanks a heap for the code Karl..cant say it helped that much. If you can see something wrong with this code...let me know:
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>$shortbio = mysql_query("SELECT substring($biography, 1, 100) FROM artist WHERE artist_id='$id'",$db);[/code]
The thing i'm trying to do is grab a band biography from the database, and shorten it down to save space. I use
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre><?php printf("%s \n", mysql_result($shortbio,0,"biography")); ?>[/code]
to try and print the shortent bio to the page, but that doesn't seem to be working. I must be doing something not quite right...or completetly wrong. One of the two
[This message has been edited by insomniac (edited May 21, 2000).]
Bookmarks