i have a forum wherein a user can create a topic,delete and edit a topic. and i have a admin panel that can delete a topic,edit and locked a topic or closed. I'm done in delete,edit and create what I'm looking for is how can i lock the topic if the problem is solved, and i want to close the topic if the topic is none of their discussion.

I already search this discussion in google.

first , i need some clarification,
what is the topic feature if that topic is locked????

and
set "is_lock" flag in your topics table in database,
then set it to 1 if it is locked, default is 0 means it is not locked.

first , i need some clarification,
what is the topic feature if that topic is locked????

and
set "is_lock" flag in your topics table in database,
then set it to 1 if it is locked, default is 0 means it is not locked.

as Shanti said, do that and then in inserting the reply check for unlocked forums. Incase the column indicates the post is locked then post back form and error message

@shanti "what is the topic feature if that topic is locked?" sir sorry for that what i mean is mark threads as solved if the topic is about a problem. sir just disable the button post-reply. if i mark the topic closed

ok then set flag and display button based on flag.

u have an extra code 4 that issue sir?

u have an extra code 4 that issue sir?

<?php
    function is_locked()
    {
      // if locked, return 1 (true)
      // else return 0 (false)
    }

    if(is_locked())
      // display "locked thread" image
    else
       // display "open thread" image
?>

@FloatingDivs thx for sharing...i need more and please elaborate your code...

@FloatingDivs thx for sharing...i need more and please elaborate your code...

I'm really unsure about how much code it is you need...do you know any PHP and MySQL? If not, maybe you should pay someone to do it for you? Quite frankly, I'm not sure how much more there is to it than the advice already given to you by the posters in this thread.

You have a database. It has a table called [insert table name containing Thread Status].

For instance, database name is "MyOwnCMS". The table name is "ThreadStatus". It contains two fields: thread ID and thread Status.

For example, the fields are called TS_ID (thread ID) and TS_Status (thread status). The ID pertains to the threads ID obviously and the TS_Status pertains to whether it's locked or opened. As you can see, there are two options: locked and opened. Thus, you only need a 0 (false) or 1 (true) as your data for TS_Status.

The function I posted in my previous post is_locked() would return a 0 if the thread isn't locked and 1 if it is.

Thus, the contents of the function is_locked() would simply query the Thread ID and find its status.

thanks, now i know what your point, it's really help.

Make sure to mark your thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.