Jump to content

Recommended Posts

So make it NULL instead.

 

edit: one thing you may not realize is that FALSE is also equal to zero, so if you are testing for the parent item, any number greater than zero is TRUE. So you can do a query for the parent item, then use a test like:

 

if($parent_item)
{
  // do some stuff
}

 

And since only items greater than zero - i.e. having a parent - will be TRUE, this will work well for you.

 

In this manner, having a zero in the table is a good thing.

Yeah...I guess I could. It just doesn't seem neat to me :P

 

I appreciate that it's probably a better option...but I think I'll leave it as is for the moment.

 

I'm a bit OCD about the neatness of my db/code. I think it makes sense to have the two fields the same.

 

For example, the interface for editing post permissions and thread permissions is one in the same. In order to get the ID of the parent thread (to check current user is allowed to edit permission etc) all I have to do is $id = $fetch['Thread'] and I have the id of the thread, or post (no matter which type it is).

 

Whereas, if `Thread` was 0 if it was actually a thread, I would have to do something like $id = ($fetch['Type'] == 'post') ? $fetch['Thread'] : $fetch['ID'];

Which is...not as neat :P

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.