almightyegg Posted April 3, 2007 Share Posted April 3, 2007 I was an idiot and decided I was going to make it more comlicated... All posts go into the same table, even the replies to other messages, they just have a rid that doesn't equal 0...so that't all fine. But I want to be able to have it so you can have replies to replies, which I can also do, but it's the way I want them to be displayed I can't fathom... I couldn't explain so I did little doodle Link to comment https://forums.phpfreaks.com/topic/45417-my-message-board/ Share on other sites More sharing options...
Leeder Posted April 3, 2007 Share Posted April 3, 2007 Hidden variables and if statements Link to comment https://forums.phpfreaks.com/topic/45417-my-message-board/#findComment-220511 Share on other sites More sharing options...
papaface Posted April 3, 2007 Share Posted April 3, 2007 We'd really need to see how you've done the database. Link to comment https://forums.phpfreaks.com/topic/45417-my-message-board/#findComment-220513 Share on other sites More sharing options...
almightyegg Posted April 3, 2007 Author Share Posted April 3, 2007 id - dur timestamp - dur rid - what the id of the post it is a reply to (if it isn't a reply it is 0) fid - what forum it is posted in title - title of the message post - main body username -person who posted it views - dur pinned - whether it stays at the top of the board perminantly Link to comment https://forums.phpfreaks.com/topic/45417-my-message-board/#findComment-220517 Share on other sites More sharing options...
almightyegg Posted April 3, 2007 Author Share Posted April 3, 2007 I thought i could do several whiles while($){ while($){ while($){ }}} etc... but I tried it and it took about 10 minutes to load the page :S how else could I do it? Link to comment https://forums.phpfreaks.com/topic/45417-my-message-board/#findComment-220534 Share on other sites More sharing options...
almightyegg Posted April 3, 2007 Author Share Posted April 3, 2007 Hidden variables and if statements I don't understand how that would work... ??? Link to comment https://forums.phpfreaks.com/topic/45417-my-message-board/#findComment-220545 Share on other sites More sharing options...
per1os Posted April 3, 2007 Share Posted April 3, 2007 Your best bet is pulling the data out of the DB and putting it into an array ordered by the main thread id. <?php $sql = "SELECT * FROM table_name WHERE id = " . $id . " AND rid = 0 LIMIT 1"; $row = mysql_fetch_array(mysql_query($result)); $threadArr[$id]['main'] = $row; mysql_free_result($result); $sql = "SELECT * FROM table_name WHERE rid = " . $row['id'] . " ORDER BY timestamp"; $result = mysql_query($result); while ($row = mysql_fetch_array($result)) { $threadArr[$id][] = $result; } $i=0; foreach ($threadArr[$id] as $key => $thread) { if ($key == "main") { print "This should be top thread information"; }else { print "This should be each replies information"; } $i++; if ($i < count($threadArr[$id])) { print "indentation line"; } } ?> Something like that should do you right, note this is untested. Link to comment https://forums.phpfreaks.com/topic/45417-my-message-board/#findComment-220558 Share on other sites More sharing options...
almightyegg Posted April 3, 2007 Author Share Posted April 3, 2007 would you mind talking me through it. It's a little past my knowledge I don't understand how it will pull multipul replies and replies of those replies etc... Link to comment https://forums.phpfreaks.com/topic/45417-my-message-board/#findComment-220562 Share on other sites More sharing options...
almightyegg Posted April 3, 2007 Author Share Posted April 3, 2007 are there any other ideas?? Link to comment https://forums.phpfreaks.com/topic/45417-my-message-board/#findComment-220617 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.