SOLUCIONADO:
En primer lugar, gracias de nuevo a
Nuexus10 por su interés.
En segundo lugar: conseguí que funcionase... para el que le pueda interesar o valer como a mí.
* Si álguien notase algún error en el código, por favor, que lo diga para poder corregirlo *
El código completo sería este:
Código:
</tr>
<?php
// CONECTANDO CON LA BASE DE DATOS
require_once("../incluye/config.php");
require_once("../incluye/funciones.php");
// CONECTANDO A MYSQL
$cnx = conectar();
// CONSULTANDO PARA CLIENTES DEL PORTFOLIO
$query_portfolioclientes = "SELECT * FROM portfolioclientes ORDER BY portfolioclientestitulo";
$portfolioclientes = mysql_query($query_portfolioclientes, $cnx) or die(mysql_error());
$row_portfolioclientes = mysql_fetch_assoc($portfolioclientes);
$totalRows_portfolioclientes = mysql_num_rows($portfolioclientes);
?>
<form enctype="multipart/form-data" name="form1" method="post" action="">
<tr>
<td colspan="2" class="texto_paginas_formularios2">¡<U>Seleccionar primero un Cliente:</U>!
<select name="portfolioclientesid" id="portfolioclientesid" onChange="javascript: document.form1.submit();">
<option value="" <?php if (!(strcmp("", $_POST['portfolioclientesid']))){echo "SELECTED";} ?>><?php
$numero_portfolioclientes = mysql_num_rows($portfolioclientes);
$item = 'Hay '.$numero_portfolioclientes.' Clientes en el Portfolio';
?><?php echo "$item"; ?></option>
<?php
do {
?>
<option value="<?php echo $row_portfolioclientes['portfolioclientesid']?>"<?php if (!(strcmp($row_portfolioclientes['portfolioclientesid'], $_POST['portfolioclientesid']))) {echo "SELECTED";} ?>><?php echo $row_portfolioclientes['portfolioclientestitulo']?></option>
<?php
} while ($row_portfolioclientes = mysql_fetch_assoc($portfolioclientes));
$rows = mysql_num_rows($portfolioclientes);
if($rows > 0) {
mysql_data_seek($portfolioclientes, 0);
$row_portfolioclientes = mysql_fetch_assoc($portfolioclientes);
}
?>
</select></td>
</tr>
</form>
<?php
// SI SE HA SELECCIONADO UN CLIENTE
if (isset($_POST['portfolioclientesid'])) {
$resultado = $_POST['portfolioclientesid'];
// CONSULTANDO
$select = "SELECT DISTINCT portfolioid, portfolio.portfolioclientesid, portfoliofoto, portfoliotitulo, portfoliotexto, portfolioclientes.portfolioclientestitulo";
$from = " FROM portfolio, portfolioclientes";
$where = " WHERE portfolio.portfolioclientesid=$resultado AND portfolioclientes.portfolioclientesid=portfolio.portfolioclientesid ORDER BY portfolioclientes.portfolioclientestitulo";
$bus = mysql_query($select . $from . $where);
//IMPRESION DE LOS DATOS
while ($bu = mysql_fetch_array($bus)){
$portfolioid = $bu["portfolioid"];
$portfoliofoto = $bu["portfoliofoto"];
$portfoliotitulo = $bu["portfoliotitulo"];
$portfoliotexto = $bu["portfoliotexto"];
$portfolioclientestitulo = $bu["portfolioclientestitulo"];
echo "<tr>
<td class='texto_paginas_clientes'>$portfolioclientestitulo</td>
<td class='texto_paginas_clientes2'>$portfoliotitulo</td>
<td rowspan='2' class='boton_paginas'><a href='portfolio_mod.php?portfolioid=$portfolioid' target='_self'><img src='images/editar_texto.png' /></a> <a href='portfolio_modfoto.php?portfolioid=$portfolioid' target='_self'><img src='images/editar_imagen.png' /></a><br><br><a href='portfolio_del.php?portfolioid=$portfolioid' target='_self'><img src='images/eliminar_texto.png' /></a></td>
</tr>
<tr>
<td class='texto_paginas_clientes'><img src='$portfoliofoto' width='100' /></td>
<td class='texto_paginas_clientes2'>$portfoliotexto</td>
</tr>\n";
}}
if (!$bus AND !$item) {
echo "<tr>
<td class='texto_paginas'>No se obtuvieron resultados</td>
</tr>\n";
}
mysql_free_result($cnx);
?>
</table>
Bueno: sinceramente tengo una duda con el último
if ya que quiero que muestre el error si el resultado obtenido "es diferente de $bus o de $item".
Por cierto: usé javascript sólo para que al seleccionar un item de la lista, el formulario se autoenviase con esa simple orden.
Gracias de todas formas y un saludo:
Javy