WLC Results Source Code

This source code uses forms to get data from the database.

[code lang="PHP"]
			No week selected";
					}
						
					echo "

Standings Sorted by Week: " . $week . "!

The percentages are determined by the formula (weekXweight - startWeight)/startWeight

//This pattern continues for 10 weeks... "; $ab = "b"; while($row = mysql_fetch_array($result)) { if($ab=="b") $ab = "a"; else $ab = "b"; echo ""; echo ""; echo ""; echo ""; //This pattern continues for 10 weeks... echo ""; $even++; } echo "
Name Wk 1 Wk 2
" . $row['name'] . "" . $row['pt01'] . "%" . $row['pt02'] . "%
"; } elseif($type == "personal") { if($person > 0) { //The user has selected a person # //Get all weeks of data (This would be $row# for that person) echo"

You selected Person #: " . $person . " - " . $namerow[$person] . "

"; echo" //This pattern continues for 10 weeks...
Name Wk 1 Wk 2 Wk 3 Wk 4 Wk 5 Wk 6 Wk 7 Wk 8 Wk 9 Wk 10
" . $namerow[$person] . " " . $pct1row[$person] . "% " . $pct2row[$person] . "%
"; } elseif($person == 0) { //Output the list of people for the user to choose from echo "

Please select a person to view the results

" . $namerow[1] . "
" . $namerow[2] . "
" . $namerow[3] . //This pattern continues for 11 members... "

"; } } elseif($type == "history") { //Show a table with all percentages per week //$result = mysql_query("SELECT * FROM wlc_spring"); echo "

Full History of the Competition

//This pattern continues for 10 weeks... "; $ab = "b"; for($x=1; $x<13; $x++) { if($ab=="b") $ab = "a"; else $ab = "b"; echo " //This pattern continues for 10 weeks... "; } echo "
Name Wk 1 Wk 2
" . $namerow[$x] . " " . $pct1row[$x] . "% " . $pct2row[$x] . "%
"; } //If this is not the first time at the page, the user will have selected a type if($type) { echo "

Check More Results?

"; } echo "

Make a selection below to view results for the Weight Loss Challenge


Weight Loss Standings

Who is leading the pack on any given week?

Choose a week that you would like to see.

/

Personal History

Select your own or any other participant's personal history

" . $namerow[1] . "
" . $namerow[2] . "
" . $namerow[3] . //This pattern continues for 11 members... "


Competition History

See how everyone has been doing weekly

"; //mysql_close($con); /* echo "

Posting array:

"; foreach ($_POST as $p => $v) { echo "The POST value at '$p' is '$v'
"; } echo "

Get array:

"; foreach ($_GET as $p => $v) { echo "The GET value at '$p' is '$v'
"; } */ echo "

View the code for this page.
"; include("wlcDbClose.php"); ?> [/code]

Author: Steph

Share This Post On

Pin It on Pinterest

Share This