como validar si existe un registro
Publicado por zendi (1058 intervenciones) el 10/07/2013 14:36:46
estoy desarrollando un codigo para validar un registro pero no lo hace si pudieran ayudarme.
NOTA: Anteriormente habia hecho otro post.
Saludos
este es el codigo:
NOTA: Anteriormente habia hecho otro post.
Saludos
este es el codigo:
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
<?php
$connect = pg_connect("host=localhost port=5432 dbname=equipos user=postgres password=root");
$equipo = "SELECT * FROM public.tipo_equipo ORDER BY nombre_equipo";
$marcas = "SELECT * FROM public.marca ORDER BY nombre_marca";
$modelos = "SELECT * FROM public.modelo ORDER BY nombre_modelo";
$unidades = "SELECT * FROM public.unidad ORDER BY unidad_nombre";
$frecuenciasmantenimiento = "SELECT * FROM public.frecuencia_mantenimiento ORDER BY mes";
$statusequipo = "SELECT * FROM public.status ORDER BY nombre_status";
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Control de Reparación y Mantenimiento de las Impresoras</title>
<script type="text/javascript" language="javascript">
/*function makeUppercase() {
document.form1.outstring.value = document.form1.instring.value.toUpperCase();
}*/
</script>
</head>
<body>
<?php
$hoy=date('d-m-Y');
?>
<form name="form1" action="guardaequipos.php" method="POST">
Control de Reparación y Mantenimiento de las Impresoras
<table width="576">
<tr>
<td width="399">Ingrese Placa Bina:</td>
<td width="173"><input type="text" name="bina" size="8"></td>
<td><input type="submit" name="action" value="Enviar"/></td>
</tr>
<?php
if (isset($_POST['submit']))
{
$connect = pg_connect("host=localhost port=5432 dbname=equipos user=postgres password=root");
$bina1 = ($_POST['bina']?$_POST['bina']:0);
$bina = @pg_query($connect,"SELECT bina FROM public.datos_equipos WHERE bina='$bina1'");
if(pg_num_rows($bina)>0){
exit("Esta bina ya existe");
}
else
{
?>
<tr>
<td>Ingrese Serial del Equipo:</td>
<td><input type="text" name="serial"></td>
</tr>
<tr>
<td>Ingrese Nombre Equipo:</td>
<td><select name="cmbequipo"><option value="0">Seleccione un Equipo..</option>
<?php
$equipo = @pg_query($connect,$equipo);
while($select2 =@pg_fetch_array($equipo)){
$ide = $select2['id_equipo'];
$name_equipo = $select2['nombre_equipo'];
echo "<OPTION VALUE='$ide'>$name_equipo</OPTION>";
}
?>
</select>
</td>
</tr>
Valora esta pregunta


0