\n"; } } if ($_REQUEST['ID'] != "") { $query = 'SELECT Title,TitleDesc,Ingred,Instructions,PrepTime,CookTime,Serves,Author FROM Recipes WHERE ID ='.$_REQUEST['ID']; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); if ($_REQUEST['Print'] == "1") { echo '
'; } while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $totalRecs = 0; foreach ($line as $col_value) { if ($totalRecs == 0) { echo "$col_value "; } if ($totalRecs == 1) { if ($_REQUEST['Print'] != "1") { echo $col_value."    Print Recipe
\n"; } else { echo $col_value."
\n"; } } if ($totalRecs == 2) { $ingredients = $col_value; $ingredients = str_replace("\n\r", "
", $ingredients); $ingredients = str_replace("\n", "
", $ingredients); $ingredients = str_replace("\r
", "
", $ingredients); $ingredients = str_replace("\r", "
", $ingredients); echo "

INGREDIENTS
$ingredients

\n"; } if ($totalRecs == 3) { $instructions = $col_value; $instructions = str_replace("\n\r", "
", $instructions); $instructions = str_replace("\n", "
", $instructions); $instructions = str_replace("\r
", "
", $instructions); $instructions = str_replace("\r", "
", $instructions); echo "

INSTRUCTIONS
$instructions

\n"; } if ($totalRecs == 4) { echo "

PREP TIME: $col_value   "; } if ($totalRecs == 5) { echo "COOK TIME: $col_value   "; } if ($totalRecs == 6) { echo "SERVES: $col_value 

\n"; } if ($totalRecs == 7) { echo "

AUTHOR: $col_value

\n"; } $totalRecs++; } } if ($_REQUEST['Print'] == "1") { echo '
Recipe Dowloaded From http://'.$_SERVER["SERVER_NAME"]; echo '
'; } } mysql_free_result($result); mysql_close($link); ?>