<?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 = "-0";
if (isset($_POST['busca'])) {
  $colname_RECEITAS = $_POST['busca'];
}
mysql_select_db($database_conreceitas, $conreceitas);
$query_RECEITAS = sprintf("SELECT * FROM receitas WHERE titulo = %s", GetSQLValueString($colname_RECEITAS, "text"));
$RECEITAS = mysql_query($query_RECEITAS, $conreceitas) or die(mysql_error());
$row_RECEITAS = mysql_fetch_assoc($RECEITAS);
$totalRows_RECEITAS = mysql_num_rows($RECEITAS);
?>
<!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>
</head>

<body>
<?php do { ?>
  <table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td><?php echo $row_RECEITAS['titulo']; ?></td>
    </tr>
  </table>
  <?php } while ($row_RECEITAS = mysql_fetch_assoc($RECEITAS)); ?>
</body>
</html>
<?php
mysql_free_result($RECEITAS);
?>
