Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

displaying only apart of a string 4

Status
Not open for further replies.

Roberti

Technical User
Joined
Mar 2, 2001
Messages
96
Location
NL
Hi all,

I have a memo field in a mysql database and I only want to display the first 40 characters on my page, how do I do that?

Greeting, Roberti
 
$str=ROW_VALUE_HERE

echo substr($str,0,40);?

Known is handfull, Unknown is worldfull
 

____________________________________________________
The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-2924

onpnt2.gif
 
or you could only read 40 characters in the sql statement

LEFT(str,len)
Returns the leftmost len characters from the string str

SELECT LEFT('foobarbar', 5)
would return 'fooba'

Worth a thought

'... and then it wouldn't compile?'
t_avatar.jpg
 
Thanx all, it works perfectly.

Greetings, Roberti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top