PHP - error de consulta

 
Vista:

error de consulta

Publicado por cristina (2 intervenciones) el 03/06/2008 20:45:11
amigos tengo problema con estos combos

el problema es que cuando seleccion el primer combo solo me trae el pimer dato de la segunda tabla

este es el codigo

<?php require_once('Connections/prueba.php'); ?>
<?php require_once('Connections/cedula.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("sisbagir");
$query_Recordset1 = "SELECT integrante.cedula FROM integrante";
$Recordset1 = mysql_query($query_Recordset1, $cedula) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<html>
<head>
<title>Documento sin título</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
<label>
<select name="select" id="select" onChange="this.form.submit()">
<?php
do {
?>
<option value="<?php echo $row_Recordset1['cedula']?>"><?php echo $row_Recordset1['cedula']?></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>
</label>
<label>
<?
$cedula=$HTTP_POST_VARS['select'];
$query_Recordset1 = "SELECT integrante.nombres FROM integrante where cedula='$cedula'";
$Recordset1 = mysql_query($query_Recordset1, $prueba) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);?>

<select name="select2" id="select2" onChange="this.form.submit()">
<?php
{
?>
<option value="<?php echo $row_Recordset1['nombres']?>"<?php if (!(strcmp($row_Recordset1['nombres'], $row_Recordset1['nombres']))) {echo "selected="selected"";} ?>><?php echo $row_Recordset1['nombres']?></option>
<?php
} while ($row_prueba = mysql_fetch_assoc($Recordset1));
{$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_prueba = mysql_fetch_assoc($Recordset1);
}}
?>
</select>
</label>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);

?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder