Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/01/2012, 11:41
chumy_
 
Fecha de Ingreso: noviembre-2011
Mensajes: 121
Antigüedad: 12 años, 5 meses
Puntos: 0
indicar que no existen registros

Estimados, tengo una lista desplegable con datos traidos desde una tabla mysql, la cual me envia a otra pagina donde hago una lista dinamica.

Código PHP:
<?php require_once('Connections/localhost.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;
}
}

mysql_select_db($database_localhost$localhost);
$query_proyectos "SELECT proy, noper FROM proyectos ORDER BY proy ASC";
$proyectos mysql_query($query_proyectos$localhost) or die(mysql_error());
$row_proyectos mysql_fetch_assoc($proyectos);
$totalRows_proyectos mysql_num_rows($proyectos);
?>
<!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>Documento sin título</title>
</head>

<body>
<form id="form1" name="form1" method="get" action="proyecto_elegido.php" target="down">
  <select name="noper" id="noper">
    <option value="">Seleccione un Proyecto...</option>
    <?php
do {  
?>
    <option value="<?php echo $row_proyectos['noper']?>"><?php echo $row_proyectos['proy']?></option>
    <?php
} while ($row_proyectos mysql_fetch_assoc($proyectos));
  
$rows mysql_num_rows($proyectos);
  if(
$rows 0) {
      
mysql_data_seek($proyectos0);
      
$row_proyectos mysql_fetch_assoc($proyectos);
  }
?>
    </select>
  <input type="submit" name="resultado" id="resultado" value="Enviar" />
</form>
</body>
</html>
<?php
mysql_free_result
($proyectos);
?>
Lo que necesito es que cuando no existan datos que mostrar diga algo, no se, "no existen registros", "no hay datos por validar", o lo que sea...

Como se hace eso?