| |
.jpg" alt="great recipes" width="498" height="338" />
|
.jpg" alt="side dish recipes" /> |
| |
| |
=$voteMessage?>
//get the recipes for the cat (or sub cat)
$catID = $_REQUEST["ID"];
$sqlrp = "select recipes.ID, recipes.Brief, recipes.Recipe_Name, recipes.Prep_Time_Hours, recipes.Prep_Time_Minutes,recipes.winner, recipes.Photo, users.First_Name, users.State_Reside from recipes, users where (users.ID = recipes.User_ID) and (recipes.Category = '$catID') and (Recipe_Name > ' ') order by recipes.TXN_TS desc LIMIT $offset, $rowsPerPage";
//if looking for a subcat then narrow the search
if( $_REQUEST["subCat"] > " "){
$theSubCat = $_REQUEST["subCat"];
$sqlrp = "select recipes_recipes_sub_cat.recipe_sub_cat_ID, recipes.ID, recipes.Brief, recipes.Recipe_Name,recipes.winner, recipes.Prep_Time_Hours, recipes.Prep_Time_Minutes, recipes.Photo, users.First_Name, users.State_Reside from recipes_recipes_sub_cat, recipes, users where (users.ID = recipes.User_ID) and (recipes.Category = '$catID') and (Recipe_Name > ' ') and (recipes_recipes_sub_cat.recipe_ID = recipes.ID) and (recipes_recipes_sub_cat.recipe_sub_cat_ID = '$theSubCat') order by recipes.TXN_TS desc LIMIT $offset, $rowsPerPage";
}
$resultrp = mysql_query($sqlrp) or die(mysql_error());
while($myrowrp=mysql_fetch_array($resultrp)){
//get rating
$rating = 3;
//get recipe rating $recid
$sqlr = "select round(avg(Rating)) as Rating from ratings where For_Recipe_ID = '$myrowrp[ID]'";
$resultr = mysql_query($sqlr) or die(mysql_error());
if($myrowr=MySQL_fetch_array($resultr)){
$rating = $myrowr["Rating"];
if($rating < 1){ $rating = 1;}
if($rating > 5){ $rating = 5;}
if($myrowr["Rating"] == 0){$rating = 3;}
}
//end of rating
$winner = $myrowrp["winner"];
?>
if ( $myrowrp["Photo"] > " "){
?>
"0000-00-00"){?> Style="position:relative; left:-25px;" } ?>>
if($winner > "0000-00-00"){?> | } ?>
); background-position:top; background-repeat:no-repeat">"> " /> |
|
| = $myrowrp["Recipe_Name"] ?> |
|
|
if( $myrowrp["Brief"] > " " ){ echo $myrowrp["Brief"] . " "; } ?>
Prep time
= $myrowrp["Prep_Time_Hours"] ?>
:
= $myrowrp["Prep_Time_Minutes"] ?>
| Rating: |  |
Votes this week:
$year = date(Y);
$weeknr = date(W);
$offset = date('w', mktime(0,0,0,1,1,$year));
$offset = ($offset < 5) ? 1-$offset : 8-$offset;
$monday = mktime(0,0,0,1,1+$offset,$year);
$date = strtotime('+' . ($weeknr - 1) . ' weeks', $monday);
//subtracted 1 to get sunday
$firstd = date('Y-m-d',$date - 1);
$sqlv = "select count(*) as thecount from votes where (DATE_ADDED >= '$firstd') and (RECIPE_ID = '$myrowrp[ID]') ";
$resultv = mysql_query($sqlv) or die(mysql_error());
if($myrowv=MySQL_fetch_array($resultv)){
echo $myrowv[thecount];
}
?>
Submitted by
= $myrowrp["First_Name"] ?>
if($myrowrp["State_Reside"] > " "){ echo "of " . $myrowrp["State_Reside"]; } ?>
" class="rightTopNavLinks style30">[Find out the recipe] |
|
}else{
?>
"0000-00-00"){?> Style="position:relative; left:-25px;" } ?>>
if($winner > "0000-00-00"){?> } ?> |
| = $myrowrp["Recipe_Name"] ?> |
|
|
if( $myrowrp["Brief"] > " " ){ echo $myrowrp["Brief"] . " "; } ?>
Prep time
= $myrowrp["Prep_Time_Hours"] ?>
:
= $myrowrp["Prep_Time_Minutes"] ?>
| Rating: |  |
Votes this week:
$year = date(Y);
$weeknr = date(W);
$offset = date('w', mktime(0,0,0,1,1,$year));
$offset = ($offset < 5) ? 1-$offset : 8-$offset;
$monday = mktime(0,0,0,1,1+$offset,$year);
$date = strtotime('+' . ($weeknr - 1) . ' weeks', $monday);
//subtracted 1 to get sunday
$firstd = date('Y-m-d',$date - 1);
$sqlv = "select count(*) as thecount from votes where (DATE_ADDED >= '$firstd') and (RECIPE_ID = '$myrowrp[ID]') ";
$resultv = mysql_query($sqlv) or die(mysql_error());
if($myrowv=MySQL_fetch_array($resultv)){
echo $myrowv[thecount];
}
?>
Submitted by
= $myrowrp["First_Name"] ?>
if($myrowrp["State_Reside"] > " "){ echo "of " . $myrowrp["State_Reside"]; } ?>
" class="rightTopNavLinks style30">[Find out the recipe] |
|
}
}?>
// print the navigation link
echo $first . ' ' . $prev . ' ' . $nav . ' ' . $next . ' ' . $la?>
|
|
|
|
|