In Progress

MYSQL QUERIES with some php

Details here:

[url removed, login to view]


user: nt24a

pwd: projectnt24a


Will post what is above in order to be published but is redundant and incomplete:

This project consists of two programs (mainly two nested mysql queries) with same logic:

a) Cron Program -> Will make calculations for ALL patients and for the day of YESTERDAY

b) Calculator Program -> Will make calculations for a SINGLE patient and for the day of TODAY

So, we will refer to a single logic regarding the Calculator Program

1. For some reason out of the scope of this project we have the table PATIENTS MEALS

Check it and you will see structure and you will see that you can modify the field QTY

That field means the quantity in grams ingested of a food code (row).

Once all quantities are edited, rows will be calculated pressing the calculator icon which is the project program.

Patient will only see the foods for TODAY. Maybe you can see other dates because it is a different view and we are developing other programs and inserting data into such table from other dates.

Reference tables are NUTRIENTS PER FOOD and NUTRIENT CODES for better understanding. Check them to understand.

1.1. LOGIC:

a) For every row (for the day of today and the selected patient) on table PATIENTS MEALS:

Check on table NUTRIENTS PER FOOD the amount of each individual nutrient for such food (row) and:

a.1) Multiply (qty on table PATIENTS MEALS by qty on table NUTRIENTS PER FOOD) and divide such resulting quantity by 100 and store it in a temporary variable (one for each defined nutrient)

a.2) Do this for all nutrients existing on table NUTRIENTS PER FOOD for such selected food (row) in PATIENTS MEALS and store each individual nutrient calculated quantity in its correspondient temporary variable.

Do this, for each row selected on PATIENTS MEALS making the cummulative sum of all nutrients contained in the entire meal (all selected rows)

After having all cummulative sums of nutrients per entire meal (all rows for such patient and the day of today)

b) Check if there is a row on table PATIENT DIARY (for such date and patient) and if so, delete it.

if non existent:

Add a new record on table PATIENT DIARY (Patient ID, date) plus all nutrients cummulative sums corresponding to table PATIENT DIARY fields and corresponding to the sum of all nutrients in the entire


As said before cron program will do the same but for ALL patients and for the day of YESTERDAY. At the end of the cron program, it will delete all records with qty=0 in table PATIENTS MEALS for cleaning purposes. (maybe should be done before calculting).

2. There is other small program to be done:

We have other TABLE X with the following fields:

id, patient_id, ndb_no, fdgrp_no, long_desc

Ask in an ajax form patient to be copied from (patient_id)

and patient to be copied to (also patient_id lets say "new" )

If there are rows for patient_id "new" in TABLE X, delete them

and copy all rows from patient_id to patient_id "new"

There are about 300 records for patient to be copied from, as an average.

Send mesaage of completion with processed rows.


php [url removed, login to view]

mySQL [url removed, login to view]

Skills: AJAX, MySQL, PHP

See more: what is record in data structure, what is data in data structure, what can you do with php and mysql, table view icon, php and mysql no codes, out of scope requirements, make an icon program, data pressing, c data structure programs, calculator program in php, calculated fields form, mysql 5.1, queries, mysql copy, meal, logic x, calculator and table, mysql add fields, average php mysql, mysql structure, mysql delete, php add record mysql table, mysql add record, php delete mysql row, delete mysql tables

About the Employer:
( 0 reviews ) CUERNAVACA, Mexico

Project ID: #2504136

Awarded to:


********hello sir ..I have skills in php ....My work always the best ..check for pm me ***********

$85 USD in 3 days
(0 Reviews)

8 freelancers are bidding on average $208 for this job


Dear sir. I sent you a private message. Please check it. Regards.

$300 USD in 3 days
(74 Reviews)

Hi we checked your requirement,We could develop as per your need. u could check that out. we would work till your satisfaction. Thanks & Regards Techwelfare -- Please check inbox for our previous work.

$247 USD in 11 days
(58 Reviews)

HI, I had gone through the requirements, and understood what you need. Please contact to discuss it further.

$225 USD in 5 days
(78 Reviews)

Hi There! Please check your PMB.

$180 USD in 5 days
(56 Reviews)

please check pmb for more details.

$250 USD in 5 days
(40 Reviews)

Please check your PM

$230 USD in 5 days
(0 Reviews)

I'm an Expert in PHP/Mysql with 5+ years Experience.

$150 USD in 3 days
(0 Reviews)