2
I have a page that searches the products in the database and shows me in the index through a include or index.php shows include with the products.
have no include an option to search by name the products in the bank.
as it separate page search arrow I don’t know how to make it open on index.
so soon brought the search values in the bank to the page giving include the problem ta being the following:
On the same page it is bringing the value of the bank products to display
and also bringing the value of product search.
I believe it is rolling the pos conflict works by showing the error message in index. but if I search it brings the result and is normal without error.
<?php include_once("conexao_produtos.php");
//Verificar se está sendo passado na URL a página atual, senao é atribuido a pagina
$pagina = (isset($_GET['pagina']))? $_GET['pagina'] : 1;
if(!isset($_GET['pesquisar'])){
}else{
$valor_pesquisar = $_GET['pesquisar'];
}
/* TRAZ OS PRODUTOS DO BANCO PARA SEREM MOSTRADOS */
//Selecionar todos os cursos da tabela
$result_curso = "SELECT * FROM produtos WHERE prod_nome LIKE '%$valor_pesquisar%'";
$resultado_curso = mysqli_query($conn, $result_curso);
//Contar o total de cursos
$total_cursos = mysqli_num_rows($resultado_curso);
//Seta a quantidade de cursos por pagina
$quantidade_pg = 6;
//calcular o número de pagina necessárias para apresentar os cursos
$num_pagina = ceil($total_cursos/$quantidade_pg);
//Calcular o inicio da visualizacao
$incio = ($quantidade_pg*$pagina)-$quantidade_pg;
/* TRAZ OS PRODUTOS DO BANCO PARA SEREM MOSTRADOS EM CASO DE BUSCA */
//Selecionar os cursos a serem apresentado na página
$result_cursos = "SELECT * FROM produtos WHERE prod_nome LIKE '%$valor_pesquisar%' limit $incio, $quantidade_pg";
$resultado_cursos = mysqli_query($conn, $result_cursos);
$total_cursos = mysqli_num_rows($resultado_cursos);
?>
as he presents to me that you are seeming error on line 17 and on line 33 to 17 got the result of the products :
$result_curso = "SELECT * FROM produtos WHERE prod_nome LIKE '%$valor_pesquisar%'";
insira o código aqui
In 33 the research.
$result_cursos = "SELECT * FROM produtos WHERE prod_nome LIKE '%$valor_pesquisar%' limit $incio, $quantidade_pg";
has this kind of problem if you put two Results on the same page?
– Léo Andrade
Leo, I read and read and I don’t understand the problem you’re having...
– LocalHost
I am with these two Results ai placed in the same tag in php they are presenting me as if they were in trouble but are displaying normal even with the message Notice: Undefined variable: valor_search in C: Program Files Easyphp-Devserver-16.1 eds-www imperionutry index_produtos.php on line 17 and tbm on line 33 but if I do a search it stops presenting me the error message and displays normal but only with the result of the search that in the case is Lina 33
– Léo Andrade
but the results are showing normal?
– LocalHost
showed yes normal friend helped I had not passed the parameters to him in case there was no search made as if it existed.
– Léo Andrade