Hi Kevin, > I am trying to find out what the best way is to display only > the first 20 or so characters of a comment. [...] > I am not sure if it is best to do it with the select statement > or format it with the PHP. Either way I am not sure how.
If you only want the first 20 characters, and that's all you ever want, it's probably best to do it with the select statement, because then you're not spending time and bandwidth getting data you don't need from your database. "SELECT LEFT(someField, 20) FROM someTable" will get you the first 20 characters. Of course, you now have a problem with words splitting :-) You can get around this either by grabbing the whole comment and splitting it on spaces, or by having a separate "synopsis" field in your database (this is how I do it). Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php