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

  • Home
  • SEARCH
  • 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 6982315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:16:18+00:00 2026-05-27T18:16:18+00:00

I’m building a availability calendar using the CodeIgniter’s calendar class. I’m generating checkboxes for

  • 0

I’m building a availability calendar using the CodeIgniter’s calendar class.
I’m generating checkboxes for each day of the month:

[ ] Morning
[ ] Afternoon
[ ] Evening

Users can check or uncheck their availability for a certain day.
The POST array looks like this:

Array (
[2011-12-01] => Array (
        [morning] => 1
        [afternoon] => 1
    )

[2011-12-02] => Array (
        [evening] => 1
    )

)

The data in the MySQL table would then look like this:

ID  |   date        |   data
- - - - - - - - - - - - - - -
1   |   2011-12-01  |   1-1-0
2   |   2011-12-02  |   0-0-1

The data value is morning-afternoon-evening 0 or 1.

If there’s no availability for a certain day (0-0-0) the row does not need to exist.
My solution would be to delete all of the rows of the month, and then insert all of the values (for example 1-0-0) for each day. That could be up to Insert 31 queries.

Question:
What’s the best solution for updating the table, without having run a lot of queries?

Thanks in advance!

PS.
I’m also not entirely sure about the way the data is stored. Perhaps a different row for each part of the day would be easier if I would like to update it upon change with jquery / ajax in the future. I would appriciate some thoughts on this as well.

  • 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-27T18:16:19+00:00Added an answer on May 27, 2026 at 6:16 pm

    The first thing I would do is separate the data field to make it more human readable. Something like this would work:

    ID  |   date        |   is_morning | is_afternoon | is_evening
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1   |   2011-12-01  |   1          | 1            | 0
    2   |   2011-12-02  |   0          | 0            | 1
    

    Secondly, I wouldn’t worry about running 31 INSERTs or UPDATEs against a database. I am not sure about your environment, but I have run scripts that update hundreds, thousands, and even tens of thousands of inserts/updates against a database. I have never noticed performance issues for anything as small as 31 queries.

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

Sidebar

Related Questions

I'm building a website that allows users to check the availability of international domain
Building an app using a calendar on a Google Apps domain that has SSL
Building a new Mobile Web Platform for Mobile Users to purchase & download content
building a site using PHP and MySQL that needs to store a lot of
Building a website that has English & Japanese speaking users, with the Japanese users
When building an ASP.NET MVC application with a goal of high availability, is it
Building a website using a PHP based Ecommerce product Magento. The problem I have
building a site which has content for each section. urls range from; /work/ /work/print/
Building a sample ASP.NET MVC app. Using the Membership API for authentication. For whatever
Building an app using android.support.v4.app , targeting API level 8. Everything's working as planned

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.