Éste es el código generado por DREAMWEAVER.
Y nuevamente gracias a todos.
Código PHP:
<?php require_once('Connections/nvabase.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_nvabase, $nvabase);
$query_Recordset1 = "SELECT * FROM municipios";
$Recordset1 = mysql_query($query_Recordset1, $nvabase) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db($database_nvabase, $nvabase);
$query_Recordset2 = "SELECT * FROM directorio";
$Recordset2 = mysql_query($query_Recordset2, $nvabase) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
$colname_Recordset3 = "%";
if (isset($_GET['municipio'])) {
$colname_Recordset3 = $_GET['municipio'];
}
$colname2_Recordset3 = "%";
if (isset($_GET['busqueda'])) {
$colname2_Recordset3 = $_GET['busqueda'];
}
mysql_select_db($database_nvabase, $nvabase);
$query_Recordset3 = sprintf("SELECT * FROM directorio WHERE idmun LIKE %s AND directorio.descripcion LIKE %s", GetSQLValueString("%" . $colname_Recordset3, "text"),GetSQLValueString("%" . $colname2_Recordset3 . "%", "text"));
$Recordset3 = mysql_query($query_Recordset3, $nvabase) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);
?>
<!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=utf-8" />
<title>Documento sin título</title>
</head>
<body>
<form id="form1" name="form1" method="get" action="prueba9.php">
<label for="municipio"></label>
Selecc Mpio:
<select name="municipio" id="municipio">
<option value="">Todos</option>
<?php
do {
?>
<option value="<?php echo $row_Recordset1['idmun']?>"><?php echo $row_Recordset1['municipio']?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
</select>
Escriba criterio de búsqueda o deje en blanco para cualquier cosa:
<label for="busqueda"></label>
<input name="busqueda" type="text" id="busqueda" />
<input type="submit" name="buscar" id="buscar" value="buscar" />
</form>
<p> </p>
<p> </p>
<table border="1">
<tr>
<td>idedo</td>
<td>idmun</td>
<td>iddir</td>
<td>descripcion</td>
<td>contacto</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset3['idedo']; ?></td>
<td><?php echo $row_Recordset3['idmun']; ?></td>
<td><?php echo $row_Recordset3['iddir']; ?></td>
<td><?php echo $row_Recordset3['descripcion']; ?></td>
<td><?php echo $row_Recordset3['contacto']; ?></td>
</tr>
<?php } while ($row_Recordset3 = mysql_fetch_assoc($Recordset3)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($Recordset2);
mysql_free_result($Recordset3);
?>