Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

php and mysql query

Posted on 2007-04-08
6
Medium Priority
?
414 Views
Last Modified: 2013-12-12
Hi,

I am trying to write a query that will extract some 2 separate data from two tables, multiply them together , store it in another table and diplay it. This is the basic structure of my tables.

1. I have a table called REPMAX which contains
- weight
- exerciseid
- memberid
(so each member has a repmax weight for each exercise)

2. I have a table called WORKOUT which has
-level
-phase
-day
-percentage
-sets
-reps
(basically this table contains the chart for what a member would be doing each day. the chart looks like this

level      phase       day     percentage      sets        reps
  1            1            1            50%            1           10
  1            1            2            45%            1            8
  1            1            3            45%            1            8

3.  I have the table called HISTORY which will basically have sessionnumber, date, the level, phase, day, weight (the repmax multiplied by the percentage from the day), the reps and the sets.

So, that we can get the right percentage from the right day, i want a way to detect which day the member is currently on, query the percentage from that day multiply it by the repmax and store it in the WORKOUT table along with the sets and reps from that day and display it to the user. So when the user clicks a button with says "show me my workout for today" all this will take place behind the scenes and it will show them data from the workout table. And then maybe if they logout, that data for the day is then stored in the HISTORY table with a date,  and sessionnumber(auto increment).  I hope this makes sense. if you think this is not a good design, I am open to any suggestions which will simplify this. Thanks

aannan
0
Comment
Question by:aannan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 2

Expert Comment

by:taveirne
ID: 18882587
i'm confused as to why you'd store something in the history table without the user saying "i did this" - it sounds like you may be storing when they said "i looked at this" - overall i'm a little vague on the design still as well.
0
 

Author Comment

by:aannan
ID: 18884201
basically, when u display that they are supposed to be doing for the day, there will be check boxes so after they are finished and they log out this will be stored in the history table. I was using the history table so that I can track what day the user is on to pick the right percentages.

As I mentioned earlier I am open to suggestions on the design. Thanks
0
 
LVL 5

Expert Comment

by:PatrickAdrichem
ID: 18893617
I'm kind of confused on this one too.

Basicly i'd store more memberinfo in the member table.
Memberid
Membername
Memberweight
etc
starting_date

This way based on the starting day you can add a day each time.
Because i don't get where you get your excersice id from @ all tbh.
0
 
LVL 5

Accepted Solution

by:
PatrickAdrichem earned 2000 total points
ID: 18893627
The query btw is

SELECT SUM(fielda * fieldb) FROM tablea INNER JOIN tableb ON tablea.fieldname = tableb.fieldname
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question