Jump to content

MySql Query Help


voxxtelum

Recommended Posts

I have a list of links (surveys) in a table that are displayed in a table after a user logs in.  When the user completes a survey, they click on a link on my site that 'completes' the survey and adds it to a separate table which includes the link id and the user id who completed the survey.

 

What I would like to do is when a user looks at the list of links again, they do not see the links they have completed.  I am kind of stuck on this and am running out of ideas.  Does anyone know a way so that I can select all the links from the completed table where the userids match and somehow use that list (or array rather) to query the links table so that they don't show up? I am not looking for specific code, but maybe just a concept or an explanation.

 

I appreciate the help,

Michael

Link to comment
Share on other sites

One option: You could restructure your other table to hold all the surveys that have not been completed instead of the ones that have. As soon as a user registers, it adds rows for all surveys and that user. Once they complete the survey the row can simply be deleted.

 

users

-------

user_id

username

etc. whatever you want

 

surveys

-------

survey_id

link

 

incomplete

----------

user_id

survey_id

 

Now all you have to do is write your query to "SELECT * FROM incomplete WHERE user_id='$var'"

I have no idea how your db is structured. I just gave some very basic example db table names and fields.

Link to comment
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.