
como puedo hacer una busqueda con where en un select
Publicado por agu (6 intervenciones) el 02/09/2016 05:59:15
hola queria preguntar como puedo hacer una busqueda con where en un select en una base sql server, supongamos que quiero buscar por CUIT como envio o donde escribo el where para que me aparesca solo ese registro:
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
<?php
$sql = "SELECT RazonSocial, CUIT, Direccion, Piso, NDepto, Email, NombreUsuario FROM EMPRESA";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false)
{
die( print_r( sqlsrv_errors(), true) );
}
$o='<table id="myTable">
<thead>
<tr>
<th>Empresa</th>
<th>CUIT</th>
<th>Direccion</th>
<th>Departamento</th>
<th>Email</th>
<th>Nombre de Usuario</th>
</tr>
</thead><tbody>';
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) )
{
$o .= '<tr><td>'. $row['RazonSocial'].'</td><td>'.$row['CUIT'].'</td><td>'.$row['Direccion'].'</td><td>'.$row['Piso'].'</td><td>'.$row['NDepto'].'</td><td>'.$row['Email'].'</td><td>'.$row['NombreUsuario'].'</td></tr>';
}
$o .= '</tbody></table>';
echo $o;
sqlsrv_free_stmt( $stmt);
?>
Valora esta pregunta


0