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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

________trim text size or MySQL Query Array______

Status
Not open for further replies.

Lynux

MIS
Aug 3, 2001
33
US
Does anyone know right off what function will allow me to trim the number of characters that a query field returns (or any variable/array for that matter)?

For example A MySQL query returns a field with 18 characters.. I am wanting to trim and display only the first 10 characters.

Thanks in advance !
:)
=================================
Imagination is more important than knowledge.
(A.E.)
 
Altertatively, if you don't need the trailing characters at all in your php script, get MySQL to do the work for you:
Code:
SELECT LEFT(fieldname,10) AS shortfieldname
FROM yourtable;
-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top