Foros del Web » Creando para Internet » Diseño web »

Ayuda con BD y menu lista

Estas en el tema de Ayuda con BD y menu lista en el foro de Diseño web en Foros del Web. 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 ...
  #1 (permalink)  
Antiguo 16/04/2008, 18:52
xio
 
Fecha de Ingreso: abril-2008
Mensajes: 4
Antigüedad: 16 años
Puntos: 0
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);
?>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:49.