Jump to content

Recommended Posts

i have this small problem trying to update the database....

 

what i have is a members site in which they can view a variety of topics, however i want the user to be able to say delete a topic they are not interested in but still keep that topic open to other users who have not blocked it

 

I'm tying to figure out how to do this, i initially had the following code:

$update_db = mysql_query("UPDATE topics SET view='2' WHERE topicID='$topicID'") or die(mysql_error());

 

I had it set to to 2 meaning that all the topics that were set to 1 were visible to the user, only those they blocked were set to 2 and only be blocked to those users who blocked them not everyone

 

The problem with that was that it blocked it to everyone

 

Can anyone help me?

 

Link to comment
https://forums.phpfreaks.com/topic/222271-need-help-updating-a-database/
Share on other sites

You need to add this information in the users table.

I imagine it would be very involved to get the functionality you're after though..

Here is how I would approach it:

 

If a user presses delete, instead of changing the values in the topics table, add a value to the users table (in a new table field), which will keep track of which topic numbers they've 'deleted'. Every time a topic is deleted, append its topic number to this field.

You will parse this field, and break it up to get each individual topic number, and make sure it isn't shown to the user.

 

Alternatively, you could add another field to your topics table, that will keep track of which users have 'deleted' the topic. Append each user to that field. Parse the field to get each user's id, and make sure it doesn't get displayed to them in the future.

 

Hope that helps

 

Denno

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.