$sqlrp = "select recipes.* from recipes, cookbook where (cookbook.Recipe_ID = recipes.ID) and (cookbook.User_ID = '" . $_SESSION["sessionUserID"] . "') and (recipes.Recipe_Name > ' ') order by recipes.TXN_TS desc LIMIT $offset, $rowsPerPage";
$resultrp = mysql_query($sqlrp) or die(mysql_error());
while($myrowrp=MySQL_fetch_array($resultrp)){
?>
if ( $myrowrp["Photo"] > " "){
?>
); background-position:top; background-repeat:no-repeat"> |
|
|
 |
}else{
?>
}
}
?>
|
$recid = $_REQUEST["recid"];
$sqlrp = "select recipes.* from recipes, cookbook where (cookbook.Recipe_ID = recipes.ID) and (recipes.Recipe_Name > ' ') and cookbook.ID = (select Max(ID) as lastID from cookbook where User_ID = '" . $_SESSION["sessionUserID"] . "')";
$msg = "This is the last recipe added to your Cookbook" ;
if($recid > " "){
$sqlrp = "select * from recipes where (ID='$recid')";
$msg = " " ;
}
$resultrp = mysql_query($sqlrp) or die(mysql_error());
if($myrowrp=MySQL_fetch_array($resultrp)){
$recipeID = $myrowrp["ID"] ;
//rating
$sql = "select avg(Rating) as rating from ratings where (For_Recipe_ID ='$recipeID')";
$result = mysql_query($sql) or die(mysql_error());
if($myrow=MySQL_fetch_array($result)){
$rate = substr($myrow["rating"],0,1) ;
switch ($rate) {
case "1.00":
$image="1";
break;
case "2.00":
$image="2";
break;
case "3.00":
$image="3";
break;
case "4.00":
$image="4";
break;
case "5.00":
$image="5";
break;
default:
$image="3";
}
}
if(($myrowrp["Prep_Time_Hours"] > " ") && ($myrowrp["Prep_Time_Minutes"] > " ")){
$prepTime = $myrowrp["Prep_Time_Hours"]. ":". $myrowrp["Prep_Time_Minutes"] ;
}
if($myrowrp["Prep_Time_Hours"] > " " && $myrowrp["Prep_Time_Minutes"] < " "){
$prepTime = $myrowrp["Prep_Time_Hours"] . ":00" ;
}
if($myrowrp["Prep_Time_Hours"] < " " && $myrowrp["Prep_Time_Minutes"] > " "){
$prepTime = $myrowrp["Prep_Time_Minutes"] . "min" ;
}
if($myrowrp["Total_Time_Hours"] < " " && $myrowrp["Total_Time_Minutes"] > " "){
$totTime = $myrowrp["Total_Time_Minutes"] . "min" ;
}
if($myrowrp["Total_Time_Hours"] > " " && $myrowrp["Total_Time_Minutes"] > " "){
$totTime = $myrowrp["Total_Time_Hours"] . ":" . $myrowrp["Total_Time_Minutes"] ;
}
if($myrowrp["Total_Time_Hours"] > " " && $myrowrp["Total_Time_Minutes"] < " "){
$totTime = $myrowrp["Total_Time_Hours"] . ":00" ;
}
?>
=$myrowrp["Recipe_Name"]?>
=$msg?>
|
if($myrowrp["User_ID"] == $_SESSION["sessionUserID"]){ ?>
" class="recipeLinks style6">[edit recipe]
|
}?>
prep time:
=$prepTime?>
| total time:
=$totTime?>
| serving size:
=$myrowrp["Serving_Size"]?>
|
| Current Rating |
 |
|
Ingredients
$sqlin = "select * from recipes_ingredients where (Recipe_ID='$recipeID')";
$resultin = mysql_query($sqlin) or die(mysql_error());
while($myrowin=MySQL_fetch_array($resultin)){
?>
=$myrowin["Amount"]?>
=$myrowin["Ingredient"]?>
}?>
|
Instructions
=$myrowrp["Instructions"]?>
|
} else {?>
Your cookbook is empty.
You can go to the recipe page to
view recipes and add them to your cookbook. |
}?>
|