$last){ $pagenum = $last; } return $pagenum; } /************************************************************ *************** ******************* ***************** CONDITION ********************* *************** ********************* ********************************************************/ //if the condition is set but not the city do this. if((isset($_REQUEST['condition']))&&(!isset($_REQUEST['scity']))&&(!isset($_REQUEST['emo']))){ // count the number of results $selectEmotion = @mysql_query("SELECT emotion, city, weatherC, temperature FROM webEmotion WHERE weatherC = '$weatherCondition' ORDER BY emotion ASC"); $numSelectEmo=mysql_numrows($selectEmotion); //This tells us the page number of our last page and isn't below 1, or highter than the max pages $last = ceil($numSelectEmo/$page_rows); $pagenum = whatpagenum($pagenum,$last); //This sets the range to display in our query $max = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows; //This is your query again, the same one... the only difference is we add $max into it $selectEmotionMax = @mysql_query("SELECT emotion, city, weatherC, temperature FROM webEmotion WHERE weatherC = '$weatherCondition' ORDER BY emotion $max"); $numSelectEmoMax=mysql_numrows($selectEmotionMax); $w=0; echo "
List of emotions submitted during this weather condition: $weatherCondition

"; $percentageWeatherSubmit = ceil(($numSelectEmo/$totalNumWeather)*100); echo "$weatherCondition is responsable for $percentageWeatherSubmit % of emotions submitted.
"; /********** PAGINATION*********/ // This shows the user what page they are on, and the total number of pages echo "Page $pagenum of $last
"; ?> "; $e++; } ?>
$fakemo1$fakcity1$fakt1

<-First "; echo " "; $previous = $pagenum-1; echo " <-Previous "; } // this shows the links for all of the pages.... for($a = 1; $a <= $last; $a++){ if($a == $pagenum) { if($numSelectEmo <= $page_rows){ }else{ //no link echo(" $a | "); } } else { echo(" $a | "); } } //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last){ }else { $next = $pagenum+1; echo " Next-> "; echo " "; echo " Last-> "; } /************************************************************8 ************* ********************** ************* emotion CONDITION ********************** ************* ****************** ********************************************************/ }elseif ((isset($_REQUEST['emo'])) && (isset($_REQUEST['condition']))) { // count the number of results $fakthis = @mysql_query("SELECT emotion, city, weatherC, temperature FROM webEmotion WHERE emotion = '$getEmo' AND weatherC = '$weatherCondition'"); $faknum=mysql_numrows($fakthis); //This tells us the page number of our last page $last = ceil($faknum/$page_rows); //this makes sure the page number isn't below one, or more than our maximum pages $pagenum = whatpagenum($pagenum,$last); //This sets the range to display in our query $max = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows; //This is your query again, the same one... the only difference is we add $max into it $fakthis1 = @mysql_query("SELECT emotion, city, weatherC, temperature FROM webEmotion WHERE emotion = '$getEmo' AND weatherC = '$weatherCondition' ORDER BY city $max"); $faknum1=mysql_numrows($fakthis1); echo "
The emotions $getEmo was submitted from the following cities when it was $weatherCondition.

"; $percentageEmoSubmit = ceil(($faknum/$totalNumWeather)*100); echo "$getEmo is responsable for $percentageEmoSubmit % of all emotions submitted.
"; /********** PAGINATION*********/ // This shows the user what page they are on, and the total number of pages echo "Page $pagenum of $last
"; ?> "; $e++; } ?>
$fakcity1 $facw1 $fakt1

<-First "; echo " "; $previous = $pagenum-1; echo " <-Previous "; } // this shows the links for all of the pages.... for($a = 1; $a <= $last; $a++){ if($a == $pagenum) { if($faknum1 <= $page_rows){ }else{ echo(" $a | "); //no link } } else { echo(" $a | "); } } //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last){ }else { $next = $pagenum+1; echo " Next-> "; echo " "; echo " Last-> "; } /************************************************************************************/ /***********************************************************************/ /****************** *******************/ /****************** CITY AND CONDITION ***********************/ /****************** *********************/ /***********************************************************************/ }elseif((isset($_REQUEST['scity']))&&(isset($_REQUEST['condition']))){ $fakthis = @mysql_query("SELECT emotion, city, weatherC, temperature FROM webEmotion WHERE city = '$selectedCity' AND weatherC = '$weatherCondition'"); $faknum=mysql_numrows($fakthis); $a=0; echo "
List of emotions submitted from the city of $selectedCity when it was $weatherCondition.

"; $percentageEmoSubmit = ceil(($faknum/$totalNumWeather)*100); echo "$percentageEmoSubmit percent of all emotions submitted were from $fakcity when it was $facw.

"; $emotion = $_REQUEST['emo']; //This tells us the page number of our last page $last = ceil($faknum/$page_rows); //this makes sure the page number isn't below one, or more than our maximum pages //calls the function to get $page_rows for the query $pagenum = whatpagenum($pagenum,$last); //This sets the range to display in our query $max = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows; //This is your query again, the same one... the only difference is we add $max into it $fakthis1_p = @mysql_query("SELECT emotion, city, weatherC, temperature FROM webEmotion WHERE city = '$selectedCity' AND weatherC = '$weatherCondition' ORDER BY city $max"); $faknum1_p=mysql_numrows($fakthis1_p); $w=0; echo "
List of the emotion $emotion. Submitted from $selectedCity

"; $percentageWeatherSubmit = ceil(($faknum1/$totalNumWeather)*100); echo "$emotion is responsable for $percentageWeatherSubmit % of emotions submitted.
"; /********** PAGINATION*********/ // This shows the user what page they are on, and the total number of pages echo "Page $pagenum of $last
"; ?> "; $e++; } ?>
$fakemo1$fakcity1$fakt1

<-First "; echo " "; $previous = $pagenum-1; echo " <-Previous "; } // this shows the links for all of the pages.... for($a = 1; $a <= $last; $a++){ if($a == $pagenum) { if($faknum <= $page_rows){ }else{ //no link echo(" $a | "); } } else { echo(" $a | "); } } //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last){ }else { $next = $pagenum+1; echo " Next-> "; echo " "; echo " Last-> "; } }elseif ((isset($_REQUEST['emo']))&&(!isset($_REQUEST['scity']))&&(!isset($_REQUEST['condition']))){ /***********************************************************************/ /****************** *******************/ /****************** EMOTION ***********************/ /****************** *********************/ /***********************************************************************/ $emotion = $_REQUEST['emo']; // count the number of results $fakthis1 = @mysql_query("SELECT emotion, city, weatherC, temperature FROM webEmotion WHERE emotion = '$emotion' ORDER BY city ASC"); $faknum1=mysql_numrows($fakthis1); //This tells us the page number of our last page $last = ceil($faknum1/$page_rows); //this makes sure the page number isn't below one, or more than our maximum pages //calls the function to get $page_rows for the query $pagenum = whatpagenum($pagenum,$last); //This sets the range to display in our query $max = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows; //This is your query again, the same one... the only difference is we add $max into it $fakthis1_p = @mysql_query("SELECT emotion, city, weatherC, temperature FROM webEmotion WHERE emotion = '$emotion' ORDER BY city $max"); $faknum1_p=mysql_numrows($fakthis1_p); $w=0; echo "
List of emotions submitted during this weather condition:$emotion

"; $percentageWeatherSubmit = ceil(($faknum1/$totalNumWeather)*100); echo "$emotion is responsable for $percentageWeatherSubmit % of emotions submitted.
"; /********** PAGINATION*********/ // This shows the user what page they are on, and the total number of pages echo "Page $pagenum of $last
"; ?> "; $e++; } ?>
$fakemo1$fakcity1$fakt1

<-First "; echo " "; $previous = $pagenum-1; echo " <-Previous "; } // this shows the links for all of the pages.... for($a = 1; $a <= $last; $a++) { if($a == $pagenum) { if($faknum1 <= $page_rows){ }else{ echo(" $a | "); //no link } } else { echo(" $a | "); } } //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last) { }else { $next = $pagenum+1; echo " Next-> "; echo " "; echo " Last-> "; } /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ }elseif ((isset($_REQUEST['emo']))&&(isset($_REQUEST['scity']))&&(!isset($_REQUEST['condition']))){ /***********************************************************************/ /******************** *****************************/ /*************** CITY AND EMOTION ******************************/ /**************** ******************************/ /***********************************************************************/ $emotion = $_REQUEST['emo']; // count the number of results $fakthis1 = @mysql_query("SELECT emotion, city, weatherC, temperature FROM webEmotion WHERE emotion = '$emotion' AND city = '$selectedCity' ORDER BY city ASC"); $faknum1=mysql_numrows($fakthis1); //This tells us the page number of our last page $last = ceil($faknum1/$page_rows); //this makes sure the page number isn't below one, or more than our maximum pages //calls the function to get $page_rows for the query $pagenum = whatpagenum($pagenum,$last); //This sets the range to display in our query $max = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows; //This is your query again, the same one... the only difference is we add $max into it $fakthis1_p = @mysql_query("SELECT emotion, city, weatherC, temperature FROM webEmotion WHERE emotion = '$emotion' AND city = '$selectedCity' ORDER BY city $max"); $faknum1_p=mysql_numrows($fakthis1_p); $w=0; echo "
List of the emotion $emotion. Submitted from $selectedCity

"; $percentageWeatherSubmit = ceil(($faknum1/$totalNumWeather)*100); echo "$emotion is responsable for $percentageWeatherSubmit % of emotions submitted.
"; /********** PAGINATION*********/ // This shows the user what page they are on, and the total number of pages echo "Page $pagenum of $last
"; ?> "; $e++; } ?>
$fakemo1$fakcity1$fakt1

<-First "; echo " "; $previous = $pagenum-1; echo " <-Previous "; } // this shows the links for all of the pages.... for($a = 1; $a <= $last; $a++) { if($a == $pagenum) { if($faknum1 <= $page_rows){ }else{ echo(" $a | "); //no link } } else { echo(" $a | "); } } //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last) { }else { $next = $pagenum+1; echo " Next-> "; echo " "; echo " Last-> "; } }elseif ((isset($_REQUEST['scity'])) && (!isset($_REQUEST['emo'])) && (!isset($_REQUEST['condition']))) { /***********************************************************************/ /******************** *****************************/ /*************** CITY ******************************/ /**************** ******************************/ /***********************************************************************/ // count the number of results $fakthis1 = @mysql_query("SELECT emotion, city, weatherC, temperature FROM webEmotion WHERE city = '$selectedCity' ORDER BY emotion ASC"); $faknum1=mysql_numrows($fakthis1); //This tells us the page number of our last page $last = ceil($faknum1/$page_rows); //this makes sure the page number isn't below one, or more than our maximum pages //calls the function to get $page_rows for the query $pagenum = whatpagenum($pagenum,$last); //This sets the range to display in our query $max = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows; //This is your query again, the same one... the only difference is we add $max into it $fakthis1_p = @mysql_query("SELECT emotion, city, weatherC, temperature FROM webEmotion WHERE city = '$selectedCity' ORDER BY emotion $max"); $faknum1_p=mysql_numrows($fakthis1_p); $w=0; echo "
List of the emotion $emotion. Submitted from $selectedCity

"; $percentageWeatherSubmit = ceil(($faknum1/$totalNumWeather)*100); echo "$emotion is responsable for $percentageWeatherSubmit % of emotions submitted.
"; /********** PAGINATION*********/ // This shows the user what page they are on, and the total number of pages echo "Page $pagenum of $last
"; ?> "; $e++; } ?>
$fakemo1$facw1$fakcity1$fakt1

<-First "; echo " "; $previous = $pagenum-1; echo " <-Previous "; } // this shows the links for all of the pages.... for($a = 1; $a <= $last; $a++) { if($a == $pagenum) { if($faknum1 <= $page_rows){ }else{ echo(" $a | "); //no link } } else { echo(" $a | "); } } //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last) { }else { $next = $pagenum+1; echo " Next-> "; echo " "; echo " Last-> "; } }elseif ((isset($_GET['country'])) && (!isset($_REQUEST['scity'])) && (!isset($_REQUEST['emo'])) && (!isset($_REQUEST['condition']))){ /***********************************************************************/ /******************** *****************************/ /*************** COUNTRY!!!!!! ******************************/ /**************** ******************************/ /***********************************************************************/ //using request it gets the users cookie which would be their current location //because it is a user selected thing it should be GET $scountry = $_GET['country']; //isset($_GET['country']); //this gets the URL country thing // count the number of results $fakthis1 = @mysql_query("SELECT emotion, city, country, weatherC, temperature FROM webEmotion WHERE country = '$scountry' ORDER BY emotion ASC"); $faknum1=mysql_numrows($fakthis1); //This tells us the page number of our last page $last = ceil($faknum1/$page_rows); //this makes sure the page number isn't below one, or more than our maximum pages //calls the function to get $page_rows for the query $pagenum = whatpagenum($pagenum,$last); //This sets the range to display in our query $max = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows; //This is your query again, the same one... the only difference is we add $max into it $fakthis1_p = @mysql_query("SELECT emotion, city, country, weatherC, temperature FROM webEmotion WHERE country = '$scountry' ORDER BY emotion $max"); $faknum1_p=mysql_numrows($fakthis1_p); $w=0; echo "
List of the emotion $emotion. Submitted from $scountry

"; $percentageWeatherSubmit = ceil(($faknum1/$totalNumWeather)*100); echo "$emotion is responsable for $percentageWeatherSubmit % of emotions submitted.
"; /********** PAGINATION*********/ // This shows the user what page they are on, and the total number of pages echo "Page $pagenum of $last
"; ?> "; $e++; } ?>
$fakemo1$fakcity1$fakcountry1$facw1$fakt1

<-First "; echo " "; $previous = $pagenum-1; echo " <-Previous "; } // this shows the links for all of the pages.... for($a = 1; $a <= $last; $a++) { if($a == $pagenum) { if($faknum1 <= $page_rows){ }else{ echo(" $a | "); //no link } } else { echo(" $a | "); } } //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last) { }else { $next = $pagenum+1; echo " Next-> "; echo " "; echo " Last-> "; } /***************************************************************8 IMAGES!!!!!!!!!!!!!!!!IMAGESSSSSSSSSSSSSSS *****************************************************************/ } else { //for fuckin images and weather function pc_grid_horizontal($array, $size){ //compute with ages $table_width = 100; $width = intval($table_width/$size); //define how and appear //sprintf() requires to use %% to get literal % $tr = ''; $td = "%s"; //open table $grid = "$tr"; //loop through entries and display in rows of size $sized $i = 0; foreach ($array as $e){ $grid .= sprintf($td, $e); $i++; //end of row //close if up and open a new one if(!($i % $size)){ $grid .="$tr"; } } //pad out remiaing calls with blanks while ($i % $size){ $grid .=sprintf($td, ' '); $i++; } //add , if nessessary $end_tr_len = strlen($tr) * -1; if (substr($grid, $end_tr_len) !=$tr){ $grid .=''; }else{ $grid = substr($grid, 0, $end_tr_len); } //close table $grid .= '
'; return $grid; } $sql = @mysql_query("SELECT DISTINCT weatherC FROM webEmotion"); $numWeather=mysql_numrows($sql); //load data afrom the db into the array //gets rid of the random extra thing at the top left duplicate. $k=0; while($k < $numWeather){ $holder = mysql_result($sql,$k,'weatherC'); $getWeatherIcon = @mysql_query("SELECT file FROM weatherIcon WHERE condition ='$holder'"); $u = 0; $numWeatherIcon=mysql_numrows($getWeatherIcon); while($u < $numWeatherIcon){ $weatherImagea = mysql_result($getWeatherIcon, $u,'file'); $u++; } $holder2 = "
$holder

"; $states[] = $holder2; $k++; } ?>