Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6163453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:49:39+00:00 2026-05-23T21:49:39+00:00

I have three tables – questions (question_id, name_of_question) – events (event_id, name_of_event, etc) –

  • 0

I have three tables

- questions (question_id, name_of_question)
- events (event_id, name_of_event, etc)
- event_questions (question_to_event_id, question_id, event_id)

When the user goes to edit an event (i.e. a row in the event table) they are present with a series of questions

- Sample Question 1
- Sample Question 2
- Sample Question 3...and so on

The way I want it is that some of the checkboxes will be checked (from the previous time they made the entry or edited the entry) but other checkboxes will remain unchecked. Either way, all the possible questions should be listed as options.

Right now I just have (incorrectly)

     $query = 'SELECT id, name 
      FROM questions
      INNER JOIN event_questions 
      ON event_questions.question_id = questions.id
      WHERE event_questions.event_id LIKE ' . $event_id;

      $rows = $wpdb -> get_results($query);

     foreach ($rows as $key=>$value) {

    $question_id = $value->id;
    $question_str = $value->name;?>
    <input type='checkbox' checked='yes' value='<?php echo $question_id; ?>' 
name='question_ids[]' />&nbsp;&nbsp;<?php echo $question_str; ?><br /><?php
}

However, what this does is ONLY show checked checkboxes (and not all possible checkboxes) AND I am passing values into the table more than once (so that an event with questions #1 and #2 becomes questions #1, #2, and #2) which is not what I want at all.

Is there a way to show all checkboxes, with the right checkboxes checked (matching the events up with the correctly selected questions) AND have it update properly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T21:49:39+00:00Added an answer on May 23, 2026 at 9:49 pm

    Select from the questions table, LEFT OUTER JOIN to the event_questions table. This will give you all the questions, and NULL values from the event_questions table where that question is not associated with the event. Those are the unchecked ones.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three tables: Employee(Id,name etc) Appointment(Id,date,time,employee id, clientid etc) Client(Id,name etc) The Employee
I have three tables: user(id, name); tasks(id, user_id, text, date); bonus(id, user_id, sum, date,
I have three tables: Users, Groups and GroupsUsers User table: id: 1 username: admin
I have three tables such as user, job and job_applied. user table has uid
I have three tables: Table User( userid username) Table Key( userid keyid) Table Laptop(
i have three tables in my database book,author,publishing ... i want the user can
I have three tables, 1-Users, 2-Softwares, 3-UserSoftwares. if suppose, Users table having 6 user
I have three tables, a user-table and two user-type tables. The user-type tables have
I have three tables. I have to retrieve the data using Linq statement. My
I have three tables (individuals, groups & recordlabels) and want use the information between

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.