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 9245901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:22:07+00:00 2026-06-18T09:22:07+00:00

Just to save anyone reading this time and trouble, DO NOT use this method

  • 0

Just to save anyone reading this time and trouble, DO NOT use this method to store surveys. As pointed out in the answer, this is incredibly poor programming (not to mention dangerous to kitties)

Forgive me if this question is somewhat convoluted. I’m working on building a program that allows users to create surveys and post them for users to take.

Long story short, I have a table that looks like this:

**survey_info**

id          bigint(20)     Auto_increment     Primary Key
title       varchar(255)
category    bigint(20)
active      tinyint(1)
length      int(11)
redirect    text

now, when a survey is created, a new table is also created that is custom built to hold hte input for that survey. The naming schema I’m using for these new tables is survey_{survey_id}

What I’m hoping to do is in the list of surveys, put the number of responses to a survey to the right of it.

Alright, now my actual question is this, is there a way to retrieve the number of rows in the collection table (survey_id) within the same query I’m using to gather the list of available surveys? I realize that I can do this easily by just using a second query for each survey and grab it’s rowcount, but my fear is that the larger the number of surveys the user has, the more time-consuming this process will become. So is there any way to do something like:

SELECT s.id AS id, s.title AS title, c.title AS ctitle, s.active AS active, s.length AS length, s.redirect AS redirect, n.num FROM survey_info s, survey_category c, (SELECT COUNT(*) AS num FROM survey_s.id) n WHERE s.category = c.id;

I just don’t know for sure how to use the s.id as part of the other table’s name (or if it can even be done)
Any help, or even a point in the right direction would be appreciated!

  • 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-06-18T09:22:08+00:00Added an answer on June 18, 2026 at 9:22 am

    You create a relational model that will store all surveys options in one table. This is a sample design:

    survey
    ------
    id PK
    title
    
    surveyOption
    --------------
    id PK
    survey_id FK
    option
    
    surveyResponse
    --------------
    id PK
    surveyOptionId FK
    response
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I get the Variables.save to save all variables, and not just the
Curious if anyone has this problem: I save my (embedded) fonts in an external
This is more of a generic question to be honest, just wondering if anyone
Has anyone made a simple DLL for Windows, so i can just save raw
I just simply save the data into files and read them out and then
UPDATE: SOLVED Hi all, i've got it, just save cookie to temp file, and
The idea: I'm just trying to save some Chinese characters to a MySQL database.
Basiclly I just want to capture audio and save it to a file on
I simply just want to count the clicks of a button and save the
i just want to ask, how can i save my json file from url

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.