Lo que realiza mi código es buscar por SERIE y todos los registros de la columna SERIE que sean iguales a SERIE se muestren cosa que si lo hace.
Lo que pasa es que no me muestra el Registro 1 que también tiene la misma SERIE
al parecer tengo que igualar serie pero no se como realizarlo.
lo siguiente es que al no encontrar dicha serie me muestre "nose encontro ningun equipo con dicha serie".
Antemano Gracias
Código PHP:
<?php require_once('../Connections/conexion_servicio_tecnico.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_Rs_buscar_registro = "-1";
if (!empty($_GET['serie'])) {
$colname_Rs_buscar_registro = $_GET['serie'];
}
mysql_select_db($database_conexion_servicio_tecnico, $conexion_servicio_tecnico);
$query_Rs_buscar_registro = sprintf("SELECT * FROM equipos_ingresados WHERE serie = %s", GetSQLValueString($colname_Rs_buscar_registro, "text"));
$Rs_buscar_registro = mysql_query($query_Rs_buscar_registro, $conexion_servicio_tecnico) or die(mysql_error());
$row_Rs_buscar_registro = mysql_fetch_assoc($Rs_buscar_registro);
$totalRows_Rs_buscar_registro = mysql_num_rows($Rs_buscar_registro);
?>
<html>
<head>
<title>Documento sin título</title>
<script type="text/javascript">
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es necesaria.\n'; }
} if (errors) alert('Para realizar la busqueda:\n'+errors);
document.MM_returnValue = (errors == '');
} }
</script>
</head>
<body>
<form name="form1" method="get" action="buscar_registro.php">
<table width="200" border="1">
<tr>
<td>Buscar Serie</td>
<td><input type="text" name="serie" id="serie"></td>
</tr>
<tr>
<td colspan="2"><input name="bserie" type="submit" id="bserie" onClick="MM_validateForm('serie','','R');return document.MM_returnValue" value="Buscar"></td>
</tr>
</table>
</form>
<table border="1">
<tr>
<td>empresa</td>
<td>contacto</td>
<td>correo</td>
<td>telefono</td>
<td>equipo</td>
<td>marca</td>
<td>modelo</td>
<td>serie</td>
<td>servicio</td>
<td>fecha</td>
<td>observaciones</td>
<td>solucion</td>
<td>operacion</td>
</tr>
<?php
while($row_Rs_buscar_registro = mysql_fetch_assoc($Rs_buscar_registro)){
echo '<tr>
<td>'.$row_Rs_buscar_registro['empresa'].'</td>
<td>'.$row_Rs_buscar_registro['contacto'].'</td>
<td>'.$row_Rs_buscar_registro['correo'].'</td>
<td>'.$row_Rs_buscar_registro['telefono'].'</td>
<td>'.$row_Rs_buscar_registro['equipo'].'</td>
<td>'.$row_Rs_buscar_registro['marca'].'</td>
<td>'.$row_Rs_buscar_registro['modelo'].'</td>
<td>'.$row_Rs_buscar_registro['serie'].'</td>
<td>'.$row_Rs_buscar_registro['servicio'].'</td>
<td>'.$row_Rs_buscar_registro['fecha'].'</td>
<td>'.$row_Rs_buscar_registro['observaciones'].'</td>
<td>'.$row_Rs_buscar_registro['solucion'].'</td>
<td>'.$row_Rs_buscar_registro['idingreso'].'</td>
</tr>';
}
?>
</table>
</body>
</html>
<?php
mysql_free_result($Rs_buscar_registro);
?>