Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Boa noite Pessoal,
Preciso terminar de colocar em meu site um sistema de busca, fiz desta forma:
Pesquisa_Cliente.php
<!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">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form id="Form_pesquisa" name="Form_pesquisa" method="post" action="Mostra_Pesquisa_Cliente.php">
<input name="busca" type="text" id="busca" />
<input type="submit" name="Submit" value="Pesquisar" />
</form>
</body>
</html>
Mostra_Pesquisa.php
<?php require_once('../Connections/Conecta.php'); ?>
<?php
$maxRows_Motra_Pesquisa = 10;
$pageNum_Motra_Pesquisa = 0;
if (isset($_GET['pageNum_Motra_Pesquisa'])) {
$pageNum_Motra_Pesquisa = $_GET['pageNum_Motra_Pesquisa'];
}
$startRow_Motra_Pesquisa = $pageNum_Motra_Pesquisa * $maxRows_Motra_Pesquisa;
$colname_Motra_Pesquisa = "-1";
if (isset($_GET['Nome'])) {
$colname_Motra_Pesquisa = (get_magic_quotes_gpc()) ? $_GET['Nome'] : addslashes($_GET['Nome']);
}
mysql_select_db($database_Conecta, $Conecta);
$query_Motra_Pesquisa = sprintf("SELECT * FROM clientes WHERE Nome LIKE '%%%s%%'", $colname_Motra_Pesquisa);
$query_limit_Motra_Pesquisa = sprintf("%s LIMIT %d, %d", $query_Motra_Pesquisa, $startRow_Motra_Pesquisa, $maxRows_Motra_Pesquisa);
$Motra_Pesquisa = mysql_query($query_limit_Motra_Pesquisa, $Conecta) or die(mysql_error());
$row_Motra_Pesquisa = mysql_fetch_assoc($Motra_Pesquisa);
if (isset($_GET['totalRows_Motra_Pesquisa'])) {
$totalRows_Motra_Pesquisa = $_GET['totalRows_Motra_Pesquisa'];
} else {
$all_Motra_Pesquisa = mysql_query($query_Motra_Pesquisa);
$totalRows_Motra_Pesquisa = mysql_num_rows($all_Motra_Pesquisa);
}
$totalPages_Motra_Pesquisa = ceil($totalRows_Motra_Pesquisa/$maxRows_Motra_Pesquisa)-1;
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">](http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)
<html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<table border="0">
<tr>
<td>codigo</td>
<td>Nome</td>
<td>pai</td>
<td>mae</td>
<td>Endereco</td>
<td>Bairro</td>
<td>Cidade</td>
<td>Estado</td>
<td>Cep</td>
<td>Cpf</td>
<td>Identidade</td>
<td>Data_Nascimento</td>
<td>Estado_civil</td>
<td>Telefone</td>
<td>Celular</td>
<td>Observacao</td>
<td>Advogado_resp</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Motra_Pesquisa['codigo']; ?></td>
<td><?php echo $row_Motra_Pesquisa['Nome']; ?></td>
<td><?php echo $row_Motra_Pesquisa['pai']; ?></td>
<td><?php echo $row_Motra_Pesquisa['mae']; ?></td>
<td><?php echo $row_Motra_Pesquisa['Endereco']; ?></td>
<td><?php echo $row_Motra_Pesquisa['Bairro']; ?></td>
<td><?php echo $row_Motra_Pesquisa['Cidade']; ?></td>
<td><?php echo $row_Motra_Pesquisa['Estado']; ?></td>
<td><?php echo $row_Motra_Pesquisa['Cep']; ?></td>
<td><?php echo $row_Motra_Pesquisa['Cpf']; ?></td>
<td><?php echo $row_Motra_Pesquisa['Identidade']; ?></td>
<td><?php echo $row_Motra_Pesquisa['Data_Nascimento']; ?></td>
<td><?php echo $row_Motra_Pesquisa['Estado_civil']; ?></td>
<td><?php echo $row_Motra_Pesquisa['Telefone']; ?></td>
<td><?php echo $row_Motra_Pesquisa['Celular']; ?></td>
<td><?php echo $row_Motra_Pesquisa['Observacao']; ?></td>
<td><?php echo $row_Motra_Pesquisa['Advogado_resp']; ?></td>
</tr>
<?php } while ($row_Motra_Pesquisa = mysql_fetch_assoc($Motra_Pesquisa)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Motra_Pesquisa);
?>
porem quando faço a pesquisa não me retorna nada.
Obrigado
Carregando comentários...