Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/10/2005, 04:43
aruizroldan
 
Fecha de Ingreso: octubre-2003
Mensajes: 280
Antigüedad: 20 años, 5 meses
Puntos: 1
¿Que falla en este código?

Hola. Tengo hecho un buscador pero a la hora de mostrar los resultados no muestra nada. Os mando el código a ver si están colocadas erroneamente las sentencias.

[B]<?
//modifica estas variables según tu servidor de MySQL
$bd_servidor = "localhost";
$bd_usuario = "usuario";
$bd_contrasenya = "clave";
$bd_bdname = "bd";
// Conexión y selección de la base de datos
$link = mysql_connect($bd_servidor,$bd_usuario,$bd_contras enya);
mysql_select_db($bd_bdname,$link);

if(isset($_POST['enviar'])) {

// Solo se ejecuta si se ha enviado el formulario
$query = "SELECT * from cassibabizcochos WHERE CODIGO == '%{$_POST['palabra']}%'";

$result = mysql_query($query,$link);
$found = false; // Si el query ha devuelto algo pondrá a true esta variable
while ($row = mysql_fetch_array($result)) {
$found = true;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Caprice Decor - Resultado de Búsqueda</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table id="Tabla_01" width="412" height="625" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4" width="412" height="10" bgcolor="#FFFFFF">
</td>
</tr>
<tr>
<td>
<img src="Images/index_02.jpg" width="11" height="165" alt=""></td>
<td colspan="3">
<img src="Images/index_03.jpg" width="401" height="165" alt=""></td>
</tr>
<tr>
<td colspan="2">
<img src="Images/index_04.jpg" width="87" height="22" alt=""></td>
<td>
<img src="Images/index_05.jpg" width="236" height="22" alt=""></td>
<td>
<img src="Images/index_06.jpg" width="89" height="22" alt=""></td>
</tr>
<tr>
<td>
<img src="Images/index_07.jpg" width="11" height="427" alt=""></td>
<td colspan="3" background="Images/index_08.jpg" width="401" height="427" valign="top" align="center">
<br><table width="60%" border="0">

<tr>
<td class="nombre" align="center"><? echo $row['PRODUCTO']; ?></td>
</tr>
<tr>
<td align="center"><img src="./imagenes/<? echo $row['NOMBRE_IMAGEN']; ?>"></td>
</tr>
<tr>
<td height="25" align="center" valign="middle" class="productos"> <table width="100%" border="0">
<tr>
<td width="37%" class="productos" align="center">
<?
if ($row['REFERENCIA'] =='')
{
echo "";
}
else {
echo "<b>Ref.</b>";
}
echo $row['REFERENCIA'];?>
</td>
<td width="26%" align="center">
<?

echo $_pagi_navegacion; ?>
</td>
<td width="37%" class="productos" align="center">
<? if ($row['CODIGO'] =='')
{
echo "";
}
else {
echo "<b>Cod.</b>";
}
echo $row['CODIGO'];?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="productos" align="center"><? echo $row['TEXTO'];?>
<? }
if(!$found) {
echo "No se encontró la palabra introducida";
}
}
?>

</td>

</tr>
</table>

</td>
</tr>
<tr>
<td>
<img src="Images/espacio.gif" width="11" height="1" alt=""></td>
<td>
<img src="Images/espacio.gif" width="76" height="1" alt=""></td>
<td>
<img src="Images/espacio.gif" width="236" height="1" alt=""></td>
<td>
<img src="Images/espacio.gif" width="89" height="1" alt=""></td>
</tr>
</table>

</body>
</html>[/
B]


Nota: lo que está en rojo es lo que aparece al ver el codigo fuente de la pagina resultados.