would (isVisible=1) work in this situation?

iWiGG_2010

Newbie

Posts: 10

Loc: Australia

3+ Months Ago

Hi Guys,

Just wondering how do I set up an admin to control a comment system. I am thinking of something like this:

An 'admin' row in the 'post' table and when the users post a comment the admin has the option to make it visible or display it. Comment moderation (isVisible=1), so that admin can disable comments in database.

Would the (isVisible=1) work for this? 1 meaning it is viewed and allowed by admin and 0 not visable?

You don't need to put isVisible in a different table... just keep it in the posts table... put 0 (or 1 if you want to have it visible) at first and only let the user with admin privileges to change it to 0 or 1.

iWiGG_2010

Newbie

Posts: 10

Loc: Australia

3+ Months Ago

thanks for your reply.

I have an admin row in the posts table.

admin type: tinyint(1) default = 1

I just don't understand how to write the function code for isVisible = 1

Bigwebmaster

Site Admin

Posts: 9117

Loc: Seattle, WA & Phoenix, AZ

3+ Months Ago

I am a little confused on what part you don't understand. Are you wanting to know how to take the data from your table and then write an if statement on if the value is a 0 or a 1 for your admin type variable? Could you explain in more detail what part you are not understanding so that we can make sure to answer the right question. Thanks!

iWiGG_2010

Newbie

Posts: 10

Loc: Australia

3+ Months Ago

hi,

Sorry for the confusion.

Could I please get help on how to write the if statement please.

This is all new to me

Bigwebmaster

Site Admin

Posts: 9117

Loc: Seattle, WA & Phoenix, AZ

3+ Months Ago

The first thing you would do is write a SQL query to get the post data for whatever post someone is looking at. One of those variables that you would have got from the SQL statement would be for your admin_type variable. This is just an example, but lets say you stored that value in: