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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:37:35+00:00 2026-05-23T11:37:35+00:00

I am working on a project and I just wanted to get some help

  • 0

I am working on a project and I just wanted to get some help on how to approach this problem and help clean up the code and remove a lot of duplication.

I have an FAQ database table with “id, user_id, faq_question, faq_text, sort_id“. Now every time a dynamic site is created, I have an insert query which creates the site and then also inserts into the FAQ table with the default questions and answers that I want to use.

    $insertFAQ = array(
        'user_id' => $user_id,
        'faq_question' => 'Default Question',
        'faq_text' => 'Default Answer',
        'sort_id' => '1'
    );


    $Db->insert('faq', $insertFAQ);

The sort_id is there because they have the ability to drag the questions in a different order and it updates the database and shows on the website in the new order.

Now the problem is that I want to have 10 default FAQ questions and answers that will be created for every website. If we get hundreds of sites in the database, that will be a ton of records in the FAQ database table which is pretty much all duplicated.

I know there has to be an easier way to do it, the only thing that throws me off is the sort_id because they could all have the same questions and answers but sort them differently. And then of course they have the ability to add custom questions.

P.S. – How can I add multiple questions/answers in the above array that I posted?

  • 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-23T11:37:35+00:00Added an answer on May 23, 2026 at 11:37 am

    AS for having multiple question in the array you posted in the question, you can just have a multi dimensional array:

    $insertFAQ = array( 
        0 =>array(
        'user_id' => $user_id,
        'faq_question' => 'Default Question',
        'faq_text' => 'Default Answer',
        'sort_id' => '1'
    ),
    
    1 =>array(
        'user_id' => $user_id,
        'faq_question' => 'Default Question',
        'faq_text' => 'Default Answer',
        'sort_id' => '1'
    ),
     2 => array(
        'user_id' => $user_id,
        'faq_question' => 'Default Question',
        'faq_text' => 'Default Answer',
        'sort_id' => '1'
    ) );`
    

    and so on and son on.

    as for the sorting –
    You can create a separate table that will just hold the sorting order, site id and question id.

    id, faq_id, site_id, sort_order
    

    Id a new site is created you just create a new entry for it in this table, and than the questions don’t have to repeat themselves, your only specifying what order goes to what site.

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

Sidebar

Related Questions

I just wanted some input on a project that I'm working on. Basically, I'm
I'm trying to get MSBuild working on a project that has just been moved
In my just-completed project, I was working getting distributed transactions working. We implemented this
I'm working on a project which is just about to start, and since I
I have just begun working on a project which uses Mercurial as a version
I'm working on a project and I'm just starting to do all the work
I'm currently working on a project with TFS source control. We've just gotten in
I've just started working on an ASP.NET project which I hope to open source
I've just started working on an existing CakePHP project. I will be developing a
I just started working on my first Visual Studio project, and I imported all

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.