Hi Guys,
Could someone please point me in the direction of a good SIMPLE example of how to store and pull images from MySQL?
Also what is the PHP function to trim text. What I would like to do is set a character length of lets say 10 and then put "..." on the end of the text. Of course the text is pulled from MySQL as well. I have checked the PHP manual and with "trim" it seems like you can only trim certain characters.
Thanks as always,
trim, cut, shorten text - also storing images in sql
Moderator: General Moderators
-
Subliminal
- Forum Commoner
- Posts: 40
- Joined: Thu Oct 23, 2003 8:12 pm
-
microthick
- Forum Regular
- Posts: 543
- Joined: Wed Sep 24, 2003 2:15 pm
- Location: Vancouver, BC
To store and retrieve images from MySQL, this is the tutorial I first learned from:
http://www.phpbuilder.com/columns/florian19991014.php3
http://www.phpbuilder.com/columns/florian19991014.php3
-
Subliminal
- Forum Commoner
- Posts: 40
- Joined: Thu Oct 23, 2003 8:12 pm
If you're going to retrive that text from mysql you can use something like this:
or if you're talking about pure php then:
Code: Select all
select concat(left(field,10),if(length(field)>10,'...','')) as field .....Code: Select all
function trim_text($text){
return substr($text,0,10).(strlen($text)>10?"...":"");
}