Ver Mensaje Individual
  #9 (permalink)  
Antiguo 10/05/2011, 14:35
otobusmzn
 
Fecha de Ingreso: abril-2011
Ubicación: En el mundo
Mensajes: 18
Antigüedad: 13 años, 1 mes
Puntos: 1
Respuesta: Obtengo error: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_S

Cita:
Iniciado por Nexus10 Ver Mensaje
Prueba así:

Código PHP:
echo "SELECT count(*) AS n_mensajes from mensajes where id_tema='".$row["id_tema"]."'"
No funciona, mirad, ahora el codigo lo tengo asi
Código PHP:
<?php 
    
include("config.php");
    
$result=mysql_query("select * from temas"); 

echo
'
    <TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1> 
    <TR><TD>&nbsp;Id. Tema</TD><TD>&nbsp;&nbsp;Tabla&nbsp;&nbsp;</TD><TD>&nbsp;Descripcion&nbsp;</TD><TD>&nbsp;Nº de Mensajes&nbsp;</TD></TR>
'
;  

   while(
$row mysql_fetch_array($result)) {
        
$temas mysql_query("SELECT count(*) AS n_mensajes from mensajes where id_tema='".$row["id_tema"]."'");
        
$row2 mysql_fetch_row($temas);
      echo
'<tr><td>&nbsp;'.$row["id_tema"].'</td>
               <td>&nbsp;<a href="mensajetabla.php?id='
.$row["id_tema"].'">'.$row["titulotema"].'</a>&nbsp;</td>
               <td>&nbsp;'
.$row["desctema"].'&nbsp;</td>
               <td>'
.$row2["n_mensajes"].'</td></tr>';
   } 
   
mysql_free_result($result); 
   
mysql_close($link); 


?> 
</table> 
<?php
echo'<br> Si no encuentras el tema que buscas, puedes crear uno como usuario registrado pulsando <a href=creartema.php>aquí</a>';
?>
y me dice: Notice: Undefined index: n_mensajes in C:\xampp\htdocs\listatemas.php on line 16