zinear wrote in php

A couple questions

1. Is there any way (without using dictionaries) to cleanly truncate a string? (That is, truncate it at a space, rather than in the middle of a word.)

e.g. "The Dynamic Nature of Insert Subject Field of Choice Right Here Described in Detail"
truncated into:
"The Dynamic Nature of Insert Subject Field..."
(rather than "The Dynamic Nature of Insert Subj..."

I tried searching for various functions that I might use to accomplish this, but I didn't find any that'd work. [Though I could have very possibly missed something.]

2. What's the best way to handle threads and posts (on a message forum script)? I've looked through some source code, and one script I looked at seemed to handle them by placing threads in on table (this is on MySQL, by the way) and the posts in another table. Presumably, the threads table would contain the post IDs? But I'm not sure how efficient it'd be to have the DB go search the posts table and retrieve each post like this. As it is, I couldn't quite figure out how it works. (This is just for a simple script; nothing nearly as fancy as say, PHP BB is needed here.) Suggestions and input appreciated.

Thanks in advance for any help.