Tema: Lista/Menú
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/08/2010, 13:41
eljuank1982
Usuario no validado
 
Fecha de Ingreso: abril-2010
Ubicación: La habana
Mensajes: 229
Antigüedad: 14 años, 1 mes
Puntos: 4
Lista/Menú

Buenas a todos:
He hecho un juego de registros en Dreamweaver 8 para manipular los datos de dos tablas que están relacionados con una. O sea una principal a la cual se le relacionan la tabla Entidades y la tabla Categorías.
La cosa es que cuando creo el formulario principal en el cual seleccionar de dos listas/menu (Entidades) (categorás) las cuales responden cada una a un juego de registro independiente; el problema es que cuando trato de desplegar alguna de las listas, las dos me dan solo el primer elemento, no me muestran el listado.

Casi la totalidad del código ha sido generado por el propio Dreamweaver lo que creo que hace menos proable algún error, por más que revizo no veo deonde está el problema.

Aquí mando el código , si alguien me pudiera ayudar con esto, o decirme donde está el error:


<?php require_once('Connections/prueba123.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO servicios (categoria, entidad, nombre, descripcion, foto) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['categoria'], "int"),
GetSQLValueString($_POST['entidad'], "int"),
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['descripcion'], "text"),
GetSQLValueString($_POST['foto'], "text"));

mysql_select_db($database_prueba123, $prueba123);
$Result1 = mysql_query($insertSQL, $prueba123) or die(mysql_error());

$insertGoTo = "Insertado OK.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}

mysql_select_db($database_prueba123, $prueba123);
$query_Jr_categorias = "SELECT nombre FROM categorias";
$Jr_categorias = mysql_query($query_Jr_categorias, $prueba123) or die(mysql_error());
$row_Jr_categorias = mysql_fetch_assoc($Jr_categorias);
$totalRows_Jr_categorias = mysql_num_rows($Jr_categorias);

mysql_select_db($database_prueba123, $prueba123);
$query_Jr_Entidades = "SELECT nombre FROM entidades";
$Jr_Entidades = mysql_query($query_Jr_Entidades, $prueba123) or die(mysql_error());
$row_Jr_Entidades = mysql_fetch_assoc($Jr_Entidades);
$totalRows_Jr_Entidades = mysql_num_rows($Jr_Entidades);

mysql_free_result($Jr_categorias);

mysql_free_result($Jr_Entidades);
?>

<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Categoria:</td>
<td><select name="select" size="1" title="">
<?php
do {
?>
<option value="<?php echo $row_Jr_categorias['nombre']?>"><?php echo $row_Jr_categorias['nombre']?></option>
<?php
} while ($row_Jr_categorias = mysql_fetch_assoc($Jr_categorias));
$rows = mysql_num_rows($Jr_categorias);
if($rows > 0) {
mysql_data_seek($Jr_categorias, 0);
$row_Jr_categorias = mysql_fetch_assoc($Jr_categorias);
}
?>
</select>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Entidad:</td>
<td><select name="select2" size="1" title="<?php echo $row_Jr_Entidades['nombre']; ?>">
<?php
do {
?>
<option value="<?php echo $row_Jr_Entidades['nombre']?>"><?php echo $row_Jr_Entidades['nombre']?></option>
<?php
} while ($row_Jr_Entidades = mysql_fetch_assoc($Jr_Entidades));
$rows = mysql_num_rows($Jr_Entidades);
if($rows > 0) {
mysql_data_seek($Jr_Entidades, 0);
$row_Jr_Entidades = mysql_fetch_assoc($Jr_Entidades);
}
?>
</select>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Nombre:</td>
<td><input type="text" name="nombre" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Descripcion:</td>
<td><input type="text" name="descripcion" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Foto:</td>
<td><input type="text" name="foto" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td><input type="submit" value="Insertar registro"></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p>&nbsp;</p>


Salu2 a To2