CALENDÁRIO de EVENTOS e FEIRAS 2019 - São Paulo - Aconteca Eventos
include("config.php");
include("inc/main_functions.php");
$webarea = "eventos";
$p = $_GET['p'];
if(empty($p)){$p=1;}
if(!empty($_GET['search_from_dia']) && !empty($_GET['search_from_mes']) && !empty($_GET['search_from_ano'])){
$data_from = $_GET['search_from_ano']. '-' .$_GET['search_from_mes']. '-' .$_GET['search_from_dia'];
}
if(!empty($_GET['search_to_dia']) && !empty($_GET['search_to_mes']) && !empty($_GET['search_to_ano'])){
$data_to = $_GET['search_to_ano']. '-' .$_GET['search_to_mes']. '-' .$_GET['search_to_dia'];
}
if((isset($data_from) && !empty($data_from)) &&
(isset($data_to) && !empty($data_to))
)
{
$busca_entre_datas = " AND (eve_dataevento_inicio BETWEEN '" .$data_from. "' AND '" .$data_to. "') ";
}
if(!empty($_GET[keyword])){$add_query1 = " AND (eve_nome like '%$_GET[keyword]%' or eve_local like '%$_GET[keyword]%' or eve_website like '%$_GET[keyword]%')";}
/*
if(!empty($_GET['search_from_dia']) && !empty($_GET['search_from_mes']) && !empty($_GET['search_from_ano'])){
$data_from = "$_GET[search_from_ano]-$_GET[search_from_mes]-$_GET[search_from_dia]";
$add_query2 = " AND eve_dataevento_inicio >= '" .$data_from. "'";
}
if(!empty($_GET['search_to_dia']) && !empty($_GET['search_to_mes']) && !empty($_GET['search_to_ano'])){
$data_to = "$_GET[search_to_ano]-$_GET[search_to_mes]-$_GET[search_to_dia]";
$add_query3 = " AND eve_dataevento_fim <= '" .$data_to. "'";
}
*/
#echo "select count(eve_cod) as total_eventos from eventos where eve_cod != '' " .$busca_entre_datas.$add_query1." ";
$q_check_eventos_count = mysqli_query($db_link, "select count(eve_cod) as total_eventos from eventos where eve_cod != '' " .$busca_entre_datas.$add_query1);
$v_q_check_eventos_count = mysqli_fetch_array($q_check_eventos_count);
$num_linhas = $v_q_check_eventos_count["total_eventos"];
$total_pages = $num_linhas / 10;
$total_pages = ceil($total_pages);
$offset = ($p-1)*10;
if((isset($add_query1) && !empty($add_query1)) ||
(isset($busca_entre_datas) && !empty($busca_entre_datas))
)
{
#echo "Query de busca: SELECT * FROM eventos WHERE eve_cod != ''" .$busca_entre_datas.$add_query1. " ORDER BY eve_dataevento_inicio ASC LIMIT ".$offset.",10 ";
$q_check_eventos = mysqli_query($db_link, "SELECT * FROM eventos WHERE eve_cod != ''" .$busca_entre_datas.$add_query1. " ORDER BY eve_dataevento_inicio ASC LIMIT ".$offset.",10");
}
else
{
#echo "SELECT * FROM eventos WHERE eve_cod != '' AND eve_dataevento_inicio >= NOW() ORDER BY eve_dataevento_inicio ASC LIMIT " .$offset. ",10";
$q_check_eventos = mysqli_query($db_link, "SELECT * FROM eventos WHERE eve_cod != '' AND eve_dataevento_inicio >= NOW() ORDER BY eve_dataevento_inicio ASC LIMIT " .$offset. ",10");
}
$v_q_check_eventos = mysqli_fetch_array($q_check_eventos);
?>
$q_check_banners = mysqli_query($db_link, "select * from banners_main where ban_main_area = 'eventos' order by rand() limit 1");
$v_q_check_banners = mysqli_fetch_array($q_check_banners);
?>