Jump to content

Recommended Posts

I have written a message board and it has been test properly, the problem is it looks naff in apearance. When I see this message board I would like to model it on this. I can't work out the top section. It seems to be in 3 sections pinned to top, pinned to top and read only, and the rest with the occasioal read only.

I can't work out the best query. all entries will be in the same table with a field type maybee of

1=Pinned

2=Pinned read only

3=other.  But then there is the ocasional read only.  their is one of these now 18 recs down.

 

Any Idea on a table structure. Would it require 3 seperate queries. Not good.

 

Desmond.

 

Link to comment
https://forums.phpfreaks.com/topic/75821-message-boards/
Share on other sites

Its a simple case of having some sort of status field and using the ORDER by clause on your query.

 

This should relate only to if a topic is pinned. You will need a different field for locking threads.

 

The reason why it appears that we have pinned, followed by pinned and read only, followed by others is simply because those which are pinned and NOT read only, have, of course, been posted in more recently that the read only topics.

 

The query to grab the topics would order by status(pinned or not) then by last post. Wether or not a topic is read only has nothing to do with the ordering.

Link to comment
https://forums.phpfreaks.com/topic/75821-message-boards/#findComment-383750
Share on other sites

I think I am going to need 3 fields 2 for the Pined and locked and a 3rd for normal locking.........

 

`id` int() NOT NULL auto_increment,

`pinned` varchar(1),

'lock' varchar(1),

`subject` varchar(255),

`content' text'

'lock2` varchar(1),  // for normal locking

 

$SQL = "SELECT * FROM Table ORDER BY pinned, lock";

 

 

Link to comment
https://forums.phpfreaks.com/topic/75821-message-boards/#findComment-383757
Share on other sites

I think I am going to need 3 fields 2 for the Pined and locked and a 3rd for normal locking.........

 

`id` int() NOT NULL auto_increment,

`pinned` varchar(1),

'lock' varchar(1),

`subject` varchar(255),

`content' text'

'lock2` varchar(1),  // for normal locking

 

$SQL = "SELECT * FROM Table ORDER BY pinned, lock";

 

 

 

Since we are talking about speeding things up don't use a varchar use an int(1) or bool, as this is simpler storage methods.  and the * operator aint' good eitehr

Link to comment
https://forums.phpfreaks.com/topic/75821-message-boards/#findComment-383759
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.