 
			
				07/02/2011, 17:29
			
			
			     |  
      |    |    |    Fecha de Ingreso: octubre-2010  
						Mensajes: 46
					  Antigüedad: 15 años Puntos: 0     |        |  
  |      Respuesta: Buenas como valido si un valor unico ya existe        Hola intente hacerlo pero no pude yo le digo si es mayor diga no existe y en misma pagina de buscar me sale arriba "no existe" la verdad no se nada de php y pudieras ayudarme esta sola vez estoy seguro que lo podra hacer en todas mis hojas de php    
El codigo desde el principio es este:   
<?php require_once('Connections/mybd.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_Recordset1 = "-1"; 
if (isset($_GET['busqueda'])) { 
  $colname_Recordset1 = $_GET['busqueda']; 
} 
mysql_select_db($database_mybd, $mybd); 
$query_Recordset1 = sprintf("SELECT * FROM afiliados WHERE afil_hist = %s", GetSQLValueString($colname_Recordset1, "text")); 
$Recordset1 = mysql_query($query_Recordset1, $mybd) or die(mysql_error()); 
$row_Recordset1 = mysql_fetch_assoc($Recordset1); 
$totalRows_Recordset1 = mysql_num_rows($Recordset1); 
if ($totalRows_Recordset1==0){ 
	echo "No existe"; 
} 
else{   
} 
?>           |