All agree with what
chromatic wrote, but I thought I'd add that
when I've written message board apps in the past, I've also
stored some "parent" data in my data structure, so that I can
walk up the board tree as well as down.
So you can add to your data structure something like:
$message{parent} = 003;
To go along w/
chromatic's structure.