-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuscar.php
143 lines (130 loc) · 4.69 KB
/
buscar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>Incentiva Construtora</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="css/estilo-menu.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans" rel="stylesheet">
</head>
<body>
<header class="container-fluid">
<div class="">
<ul class="nav nav-pills pull-right">
<li><a href="index.php">HOME</a></li>
<li><a href="#prefeitura">PREFEITURA</a></li>
<li><a href="#">CONTATO</a></li>
</ul>
</div>
<div class="row-fluid menu">
<a href="" class="navbar-brand">Incentiva Construtora</a>
<form action="buscar.php" method="post">
<div class="input-group col-xs-12 col-md-4 col-md-offset-4 pesquisa">
<input type="text" name="busca" placeholder="Pesquise pelo Protocolo" class="form-control">
<span class="input-group-btn">
<button class="btn btn-info" type="submit"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>
</span>
</div>
</form>
</div>
</header>
<div class="container-fluid tabela">
<table class="table table-hover" >
<thead>
<tr>
<th>ID</th>
<th>Nome Projeto</th>
<th>Responsavel</th>
<th>Telefone</th>
<th>Lote</th>
<th>Quadra</th>
<th>Logradouro</th>
<th>Bairro</th>
<th>Tipo</th>
<th>Data Inicio</th>
<th>Data Término</th>
<th>Status</th>
<th>Protocolo</th>
</tr>
</thead>
<tbody>
<?php
//conexao com o banco
$servidor = 'localhost';
$usuario = 'root';
$senha = '';
$banco = 'cadastro';
$conexao = mysqli_connect($servidor,$usuario,$senha,$banco);
$selecao = mysqli_select_db($conexao,$banco);
//atribui a consulta em uma variavel
$busca = mysqli_real_escape_string($conexao,$_POST['busca']);
$todos = 'tudo';
/*if(!empty($busca)){
if(is_numeric($busca))
$result = mysqli_query($conexao,"SELECT * FROM projeto where protocolo like '%".$busca."%'");
$linha = mysqli_num_rows($result);
}else{
header("location: http://localhost/Incentiva%20Construtora/");
exit;
}
*/
if(!empty($busca)){
$result = mysqli_query($conexao,"SELECT * FROM projeto where info_status like '%".$busca."%' limit 7");
$linha = mysqli_num_rows($result);
}else{
header("location: http://localhost/Incentiva%20Construtora/");
exit;
}
if ($linha > 0){
while($linha = mysqli_fetch_array($result)){
$id = $linha['id'];
$nome = $linha['nome_proj'];
$responsavel = $linha['nome_resp'];
$telefone = $linha['telefone'];
$lote = $linha['lote'];
$quadra = $linha['quadra'];
$logradouro = $linha['logradouro'];
$bairro = $linha['bairro'];
$tipo = $linha['tipo'];
$dt_inicio = $linha['data_inicio'];
$dt_termino = $linha['data_fim'];
$status = $linha['info_status'];
$protocolo = $linha['protocolo'];
echo "<tr>";
echo "<td><a target='_blank' href='./tabela/editar.php?codigo=$id'>".$id."</td>";
echo "<td>".$nome."</td>";
echo "<td>".$responsavel."</td>";
echo "<td>".$telefone."</td>";
echo "<td>".$lote."</td>";
echo "<td>".$quadra."</td>";
echo "<td>".$logradouro."</td>";
echo "<td>".$bairro."</td>";
echo "<td>".$tipo."</td>";
echo "<td>".$dt_inicio."</td>";
echo "<td>".$dt_termino."</td>";
echo "<td>".$status."</td>";
echo "<td>".$protocolo."</td>";
echo "</tr>";
}
}
?>
</tbody>
</table>
</div>
<div class="container-fluid" id="botoes">
<div class="col-md-12">
<a href="index.php"><button type="button" class="btn btn-warning" >Voltar</button></a>
<!-- <a target="_blank" href=""><button type="button" class="btn btn-warning">Alterar</button></a> -->
</div>
</div>
<!-- Rodapé -->
<div class="container-fluid rodape">
<footer>
<p>copyright °° Incentiva Construtora Ltda</p>
</footer>
</div>
</body>
</html>