Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/05/2004, 12:18
odilon
 
Fecha de Ingreso: septiembre-2003
Ubicación: Cancun mexico
Mensajes: 50
Antigüedad: 20 años, 7 meses
Puntos: 0
Pregunta Como insertar los resultados de consulta?

Hola que tal, llevo una semana metiendole duro a aprender PHP, ahora estoy aprendiendo ha hacer consultas, hasta ahora si me arroja los resultados de las consultas, pero intento metarlos dentro de código html y no me queda me arroja error de : T_CONSTANT_ENCAPSED_STRING, pero le quito el código html y ningun error.
Los resultados de mi consulta van dentro de celdas y la verdad no hayo la forma de meterlos, les voy a poner mi codigo que hasta ahora llevo, en el cual no me da error ya que no hay dentro del código del resultado codigo html.

Espero alguien me pueda explicar como hacerle:

CODIGO :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<?php
include("conex.php");
$link=Conectarse();
?>
<head>
<title>Consulta a la DB</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
$result = mysql_query("select * from cd_releases",$link);
if (!$result)
{
echo("<p>Error haciendo la consulta en: " . mysql_error() . "</p>");
exit();
}
?>
<table width="760" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="760" height="44" valign="top">Estos son los datos insertados en
la DB de MY SQL con php, si quieres insertar m&agrave;s datos presiona <a href="alta.htm">aqui</a></td>
</tr>
<tr>
<td height="299" valign="top">
<?php
while ($row = mysql_fetch_array($result))
{
//variables de ejemplo
printf ($row["Artist"]);
printf ($row["Title"] );


}
mysql_free_result($result);
mysql_close($link);
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="192" height="25" valign="top">Artista</td>
<td width="232" valign="top">Titulo</td>
<td width="71" valign="top">A&ntilde;o</td>
<td width="102" valign="top">LABEL</td>
<td width="163" valign="top">N&ugrave;m pistas</td>
</tr>
<tr>
<td height="29" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
</table>

</td>
</tr>
<tr>
<td height="77">&nbsp;</td>
</tr>
</table>

</body>
</html>


MIL GRACIAS

Última edición por odilon; 31/05/2004 a las 12:20 Razón: me falta variables