include_once("conf/configuracion.inc.php"); $oBD = BaseDatos::getConexion(); if(isset($_GET['n']) && $_GET['n'] != ""){ $n = $_GET['n']; }else{ $n = 0; } $clase1 = ""; $clase2 = ""; $clase3 = ""; $clase4 = ""; $clase5 = ""; if(isset($_GET['tp']) && $_GET['tp'] != ""){ if($_GET['tp'] == 1){ $tipoPlato = "and tipo_plato = 'Sopa' "; $textoTit = "Sopas"; $clase1 = "bts_selec"; }elseif($_GET['tp'] == 2){ $tipoPlato = "and tipo_plato = 'Plato principal' "; $textoTit = "Platos Principales"; $clase2 = "bts_selec"; }elseif($_GET['tp'] == 3){ $tipoPlato = "and tipo_plato = 'Entrada' "; $textoTit = "Entradas"; $clase3 = "bts_selec"; }elseif($_GET['tp'] == 4){ $tipoPlato = "and tipo_plato = 'Postre' "; $textoTit = "Postres"; $clase4 = "bts_selec"; }else{ $tipoPlato = ""; $textoTit = "Recetas"; $clase5 = "bts_selec"; } $tp = $_GET['tp']; }else{ $tp = 0; $textoTit = "Recetas"; $clase5 = "bts_selec"; } $ban=0; $ban2 = 0; $filtro = ""; $urlVar = ""; if(isset($_GET['autor']) && $_GET['autor'] == 1){ $ban2=1; if($ban==0){ $ban=1; }else{ $filtro .= " or "; } $filtro .= "nombre like '%".$_GET['buscar']."%'"; $urlVar .= "&autor=1"; }else{ } if(isset($_GET['ingrediente']) && $_GET['ingrediente'] == 3){ $ban2=1; if($ban==0){ $ban=1; }else{ $filtro .= " or "; } $filtro .= "ingredientes like '%".$_GET['buscar']."%'"; $urlVar .= "&ingrediente=3"; } if(isset($_GET['receta']) && $_GET['receta'] == 2){ $ban2=1; if($ban==0){ $ban=1; }else{ $filtro .= " or "; } $filtro .= "plato like '%".$_GET['buscar']."%'"; $urlVar .= "&receta=2"; } $sqlNumRecetas = "select count(*) as num from saborec_receta2 where (estado = 1 or estado = 2) ".$tipoPlato." and (".$filtro.")"; $aNumRecetas = $oBD->GetAll($sqlNumRecetas); $total_records = $aNumRecetas[0]['num']; $pages = intval($total_records / 10); $inicial = $n * 10; $sqlRecetas = "select * from saborec_receta2 where (estado = 1 or estado = 2) ".$tipoPlato." and (".$filtro.") order by plato asc limit ".$inicial.",10"; $aRecetas = $oBD->GetAll($sqlRecetas); ?>