Page 1 of 1

Loading only an amout of characters

Posted: Fri Jun 27, 2003 1:46 pm
by Jay Eff
How do I take make a mySQL query that only loads a set amout of variables from a field?
Example: If I have a title for a forum post, and only want to display the first 20 letters of the title on the print out of posts.

Please help, I can't find it anywhere. :?

Posted: Fri Jun 27, 2003 1:50 pm
by JPlush76
check out the function substr()
(SUBSTRING)

Code: Select all

<?php

// TAKE THE OLD FIELD AND START AT THE FIRST CHARACTER AND JUST GIVE ME THE FIRST 20 AFTER THAT
$field = substr($oldfield, 0,20);

?>

Posted: Fri Jun 27, 2003 2:03 pm
by Jay Eff
thank you a lot