Retroceder   Foros del Web > Diseño de Sitios web > Web general

Respuesta
 
Herramientas Desplegado
Antiguo 16-abr-2008, 19:52   #1 (permalink)
xio
xio ha deshabilitado el karma
 
Fecha de Ingreso: abril-2008
Mensajes: 2
Ayuda con BD y menu lista

Necesito ayuda con esto, no se donde está el error pero no muestra nada cuando le doy al boton y deberia mostrar todos los registros con las coincidencias que hay en la Bd al elegirlos con los menu lista

dejo codigo completo. Muchas gracias por adelantado.

<?php require_once('Connections/datos.php'); ?>

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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_datos, $datos);
$query_Recordset1 = "SELECT inmuebles.Tipo,Provincia FROM inmuebles";
$Recordset1 = mysql_query($query_Recordset1, $datos) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

if(isset($_POST['prov']) && ($_POST['prov'] >0)){
$SQLstr = sprintf("SELECT * FROM inmuebles WHERE field LIKE %s, %s;",$_POST['tip'],$_POST['prov']);
mysql_select_db($database_datos, $datos);
$Selected = mysql_query($SQLstr, $datos) or die(mysql_error());
$row_Selected = mysql_fetch_assoc($Selected);
$totalRows_Selected = mysql_num_rows($Selected);
}

?><!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&iacute;tulo</title>
</head>

<body>
<form name="form1" method="post" action="busca2.php">

<p>
<select name="prov" id="prov" title="<?php echo $row_Recordset1['Provincia']; ?>">
<?php
do {
?>
<option value="<?php echo $row_Recordset1['Provincia']?>"><?php echo $row_Recordset1['Provincia']?></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>
menu lista desplegable id=prov(provincia)</p>
<p>
<select name="tip" id="tip" title="<?php echo $row_Recordset1['Tipo']; ?>">
<?php
do {
?>
<option value="<?php echo $row_Recordset1['Tipo']?>"><?php echo $row_Recordset1['Tipo']?></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>
menu lista desplegable id tip(tipo)</p>
<p>&nbsp;</p>
<p>
<input name="buscar" type="submit" id="buscar" value="quiero que haga Select * FROM inmuebles LIKE tip,prov" f/>
este boton (para buscar las coincidencias y mostrarlas en la tabla de esta pagina.</p>
<table width="741" height="55" border="3" cellpadding="11" cellspacing="12" bordercolor="#0000FF">
<?php
if($totalRows_Selected >0){ // si hay registros
do{
?>
<tr>
<td>
<?php echo $row_Selected['field']; ?>
</td>
<?php }while($row_Selected= mysql_fetch_assoc($Selected));
}
?>
</tr>
</table>
<p>&nbsp;</p>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
xio está desconectado   Responder Citando
Respuesta

No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 17:55.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96