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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:46:42+00:00 2026-05-28T03:46:42+00:00

I might be doing this the wrong way when I set up the tables?

  • 0

I might be doing this the wrong way when I set up the tables?
I’m using mysql & php. Loads of googleing only shows how to count how many times a value appears in several rows, I want check for a value in many different columns but in the same record. (I think this: count number of columns that have data for each row just might be about the same thing, maybe? but I don’t get it.)

I have a table with goals that I hope to work on and achieve every day. So for every day I wish to mark: “success” or “fail”. And insert is working great. How ever I’m looking for a way to calculate the number of success& number of fails of “today”, to show the right kind of smiley which will be encouraging or sad depending on number of fails and number of successes.

For example:

ID  date          drinkMoreWater    goToBedEarlier    callADearFriend
1   2012 jan 15   fail              fail              fail
1   2012 jan 16   success           _(still empty)    success

So if today is jan 15 the smiley will be very very sad.
If today is jan 16 the smiley will be really really hppy with stars in it’s eye’s (atleast until I fail goal 2 😉 )

  • 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-28T03:46:43+00:00Added an answer on May 28, 2026 at 3:46 am

    Your tables should actually be structured differently to make your life easier:

    Goals:
    ID     Goal
    1      drinkMoreWater
    2      goToBedEarly
    3      callADearFriend
    
    Status:
    ID     Status
    1      Success
    2      Fail
    
    Tracking:
    ID     Date      Goal_ID     Status_ID
    1      1/1/2012  1           1
    1      1/1/2012  3           2
    1      1/2/2012  2           1
    1      1/2/2012  4           1
    

    Now you could easily add goals and status (e.g. ‘Working on it’) and your table structure does not have to change to accommodate your changes, your queries become a lot simpler as well.

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

Sidebar

Related Questions

I might be going about this in totally the wrong way but this is
I can't seem to get a custom action working. I might be doing this
I'm new to Java Web Services, so I might be doing things wrong. I'm
Okay, so it seems, for some reason (I might be doing it wrong, obviously),
I can't see what I'm doing wrong. I think it might be one of
I might be going about this all wrong, so hopefully someone will tell me
A while ago I was trying to figure out a way of doing this
I know this might be a bit of a silly question, probably doing it
So I might be asking this in the wrong place. I figured since it
Maybe I'm doing something really wrong, but somehow this code always crashes with a

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.