Hello everyone,
I am working on a weight loss app for my site, and I want to display the user's weight lost in the past week, I have the current weight and the total weight lost today working great, but I was at a loss on how to get the weight for the past week to work
Here is the code that I'm working with:Code: [Select]mysql_select_db($database_getfit, $getfit);
$query_getfit_xml = "SELECT * FROM jos_my_weight ORDER BY `date` DESC"; // DESC and ASC
$getfit_xml = mysql_query($query_getfit_xml, $getfit) or die(mysql_error());
$row_getfit_xml = mysql_fetch_assoc($getfit_xml);
$totalRows_getfit_xml = mysql_num_rows($getfit_xml);
// START WEIGHT
$start_weight = '230';
// GOAL WEIGHT
$goal_weight = '175';
$rows = array();
while($row = mysql_fetch_assoc($getfit_xml)):
$rows[] = $row;
endwhile;
$xml = '<?xml version="1.0" encoding="utf-8"?>'."n";
$xml .= '<chart>'."n";
$xml .= ' <chart_data>'."n";
// GET DATES
$xml .= ' <row>'."n";
$xml .= ' <null/>'."n";
foreach($rows as $row):
$xml .= '<string>'.$row['date'].'</string>'."n";
endforeach;
$xml .= ' </row>'."n";
// GET CURRENT WEIGHTS
$xml .= ' <row>'."n";
$xml .= ' <string>Current Weight</string>'."n";
foreach($rows as $row):
$xml .= '<number>'.$row['weight'].'</number>'."n";
endforeach;
$xml .= ' </row>'."n";
// GET TOTAL WEIGHT LOST TO DATE
$xml .= ' <row>'."n";
$xml .= ' <string>Total weight lost to date</string>'."n";
foreach($rows as $row):
$weight_lost = $start_weight - $row['weight'];
$xml .= '<number>'.$weight_lost.'</number>'."n";
endforeach;
$xml .= ' </row>'."n";
// GET WEIGHT LOST THIS WEEK
$xml .= ' <row>'."n";
$xml .= ' <string>Total weight lost to date</string>'."n";
$i = 0;
foreach($rows as $row):
$xml .= '<number>'.$row['weight'].'</number>'."n";
$i++;
endforeach;
$xml .= ' </row>'."n";
$xml .= ' </chart_data>'."n";
$xml .= '</chart>';
echo $xml;
mysql_free_result($getfit_xml);
Coefficient of a Restitution Hints
Hello. I was wondering if anyone can give me hints on how to write this program...The coefficient of a restitution of a ball, a number between 0 and 1, specifiies how much energy is conserved when a
EU VAT Package 2010
Does any one know whether SAP will be developing new reporting functionality due the new VAT rules the European Commission want to implement from 2010?
PHP mail() with images
I'm trying to get images to send along with my HTML e-mail sent through PHP mail(). I only tried viewing the e-mail through google mail and thunderbird, google mail showed the image but thunderbird
Search in the PHP Files
have to search asterisk(*) in the php code of the php files .
Function module "DPS_CHECK_TABLE_EXISTS" not found (after OSS 1422843 impl)
Dear All,
How to limit the calls to an API
Hello, in my simple script I call an api which effectively involves me getting an xml file.However the problem is everytime I get a visitor to the webpage it calls the API which means lots of wasteful
Creating a unique 'control panel' for each user
Hi there,I'm thinking of designing a site that will allow users to sign up and have their own unique 'control panel'.I just need some pointers on the logic behind this design, specifically:How can I
Displaying a clickable playername
I am going wrong somewhere with the mysql_query, can someone please put me straight?$playername = mysql_query("SELECT * FROM `players` WHERE `playername` LIMIT 1");while($f =
parse error
Parse error: syntax error, unexpected '[', expecting ')' in /Users/admin/Sites/phptest/array.php on line 5 Code: <?phpfunction shippingPrice($zone,$weight){ $ground = array(2 => array
How to get the previous months last date....
Here's my wittle problem. I suck at working with dates.So today is 10/20/2009, i need to figure out how to useCode: $lastmonth = date("m-d-Y", strtotime(" "));in order to get