Don't know how to do it!

Hello there,

I am creating a website for my client. They are Fitness company and want an area for clients to log in and have access to their own fitness and diet tracker. They can log their exercises and it will calculate calories burnt, and also be able to log their food intake and calculate calories consumed and then output graphs and so on. The website will be similar in function to sites like FitDay and DailyBurn. I understand that this will involve PHP and MySQL but I am hoping someone can point me in the right direction in learning how to do this.

Many thanks,


Crikey, where do you want to start?

Haha. I understand that there is a lot of work here Anthony. I guess the membership login is fairly straightforward but I need help with the fitness and diet tracker mostly. Would it be easier to purchase a script of some sort?

Something like this seems like it would be the most efficient and client friendly way of getting the data your after without entering it individually. You could sync up a request to api through a CRON and update the database on your site every so often. You would just need to figure out a way to identify a unique food product when mixed in with food products defined directly within your site. If your not going to go the api route than an import for the data through a csv will most likely be the practical alternative to at least get the data in the database without going in and inserting everything manually. Also, if it were me I wouldn’t develop this to dependent on their site but for use in a reusable fashion across multiples. Just so that if someone comes along and requests the same time of functionality you can make more money without developing the entire thing from scratch. The calculator is really in all senses of a separate product or application that is used by the site. I wouldn’t make it reliant on it and try to keep it as loosely coupled to the rest of the site as possible for that reason. Of course you would want the branding the layout consistent with the site but in regards to the functionality I would separate it out into a completely separate code structure for reuse in other projects once built. I may even recommend to go as far as to use a separate database from the rest of the site.

using Drupal isn’t going to make the project any easier. There’s still alot of customization to the type of system that deals with calculating the calories, and spitting out results based on the user’s preference, body, weight whatever.

Cranial is right alot of the work is really going to be on the client.

You should sit down the with client try to figure out a formula develop a skeleton based on the discussion; code it and put up sample or 2 and let the client deal with the data entry and the rest of it.

If the client is the fitness company, surely it’s more within their area of expertise to have formulae, or rules of thumb to calculate energy in and out for various foods and activities. I would not be taking on the job of coming up with these processes. You’ll need that from your client to work out how to store and process the data.

If you want to actually complete a project like this, within time and budget, your going to need a system like Drupal, otherwise someone is going to get burned, probably both you and your client.


Thank you both Anthony and Shaydez. I was hoping to use something similar to the database that you provided in the link (thanks for that), and also allow the front end user to enter custom foods.

I would need to find or create a similar database which lists activities such as walking, running, etc and allow the user to input time spent doing an activity and then calculate how many calories were burnt.

These results would then be used in a pie chart for average daily calorie intake, a graph for weight change and a bar chart for average calorie balance (calories consumed vs. calories burned)

Any more ideas? Thanks!

Google: Food Calories Database Download

5 minutes later
This is what you exactly need… now half your project is done. lol

pff… I honestly wouldn’t even take the project… i know where to start and how to do it… but its just ALOT of work, too many variables, etc…

Anthony is on the right track… Come up with a Database Design before even touching PHP … if you really want the project … turn off your computer grab a pencil and paper and start drawing out the database design what’s involved how would you do it… look at other competitors and see what they’re doing how would you copy their method?

I can give you a hint… skeleton structure and have the client input everything
Apple - 5 calories
Cheeseburger 1200 calories
McDonalds Big Mac 1500 Cal
McDonalds Big Mac Meal 2400 Cal and so forth.

I try to forget about PHP at this stage, and concentrate on how I’m going to store the data I need.

In short, start with the database.

If you’re calculating calories consumed for example, you’re going to need the calories count for any given foodstuff. Ouch.

What happens if I have my Gran’s ‘cheesey peas’ ? Would you have that? Probably not.

Maybe you should store ingredients then? But which, cooked or raw?

Honestly, right now, I have no idea how you’ll do this.

Luckily though, you have a few existing applications to base yours off. Phew! Create accounts, get a feel for the application and start making some educated guesses on how the may store/obtain the data required.

Exercise is going to be a funny one too…

I’m not sure how you would work out the calories burned for say, a 30 minute run in the park.

Surely you’d need to know the speed I ran? Would I know that, as a user?

So, where now? :wink: