<?php require_once('../Connections/receitas.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_Rsdetalhes = "-1";
if (isset($_GET['id'])) {
  $colname_Rsdetalhes = $_GET['id'];
}
mysql_select_db($database_receitas, $receitas);
$query_Rsdetalhes = sprintf("SELECT * FROM receitas WHERE id = %s", GetSQLValueString($colname_Rsdetalhes, "int"));
$Rsdetalhes = mysql_query($query_Rsdetalhes, $receitas) or die(mysql_error());
$row_Rsdetalhes = mysql_fetch_assoc($Rsdetalhes);
$totalRows_Rsdetalhes = mysql_num_rows($Rsdetalhes);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>INGREDIENTES</title>
<link href="../cssresp/estilosreceitas.css" rel="stylesheet" type="text/css">
</head>

<body>
<div class="detalhes">
  <h4><?php echo $row_Rsdetalhes['titulo']; ?></h4>
  </p>
  <p>INGREDIENTES:<br>
<?php echo nl2br ($row_Rsdetalhes['ingredientes']); ?></p>
  <p>MODO DE PREPARO:<br>
  <?php echo  nl2br ($row_Rsdetalhes['preparo']); ?></p>
</div>

</body>
</html>
<?php
mysql_free_result($Rsdetalhes);
?>
