<?php require_once('../Connections/conreceitas.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_receitas = "-1";
if (isset($_GET['id'])) {
  $colname_receitas = $_GET['id'];
}
mysql_select_db($database_conreceitas, $conreceitas);
$query_receitas = sprintf("SELECT * FROM receitas WHERE id = %s", GetSQLValueString($colname_receitas, "int"));
$receitas = mysql_query($query_receitas, $conreceitas) or die(mysql_error());
$row_receitas = mysql_fetch_assoc($receitas);
$totalRows_receitas = mysql_num_rows($receitas);
?>

<script type="text/javascript">
<!--
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
//-->
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="../style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="10">
  <tr>
    <td align="center" class="stilo"><span class="stilo24">UM COZINHEIRO E QUATRO ESFOMEADOS</span></td>
  </tr>
  <tr>
    <td align="center" class="stilo"><a href="editar.php?id=<?php echo $row_receitas['id']; ?>">EDITAR</a></td>
  </tr>
  <tr>
    <td align="center" class="stilo"><?php echo $row_receitas['titulo']; ?></td>
  </tr>
</table>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="10">
  <tr>
    <td class="stilo">INGREDIENTES:</td>
  </tr>
  <tr>
    <td class="stilo1"><?php echo nl2br($row_receitas['ingredientes']); ?></td>
  </tr>
  <tr>
    <td class="stilo">PREPARO:</td>
  </tr>
  <tr>
    <td class="stilo1"><?php echo nl2br($row_receitas['preparo']); ?></td>
  </tr>
  <tr>
    <td align="center" class="stilo2" onClick="MM_callJS('print()')">&nbsp;</td>
  </tr>
  <tr>
    <td align="center" class="stilo2"><a href="inicio.php" target="_parent">VOLTAR</a></td>
  </tr>
  <tr>
    <td align="center" class="stilo2" onClick="MM_callJS('print()')"><a href="#">IMPRIMIR</a></td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result($receitas);
?>
