Error:
Código PHP:
Notice: Undefined variable: context in C:xampphtdocsaplantillaforo.plantilla.php on line 223
Warning: Invalid argument supplied for foreach() in C:xampphtdocsaplantillaforo.plantilla.php on line 223
Código PHP:
function post_topic()
{
$get_topic=$_GET['id'];
echo conexion();
$request=mysql_query("SELECT
SQL_CALC_FOUND_ROWS
e.id, e.titulo, e.contenido, e.categoria,
e.id_user, e.user_name, e.fecha, u.usuario,
u.id, u.avatar, u.rango
FROM entradas as e, usuarios as u
WHERE e.id = '".$get_topic."' AND e.id_user = u.id
LIMIT 1")or die(mysql_error());
while ($row = mysql_fetch_assoc($request)){
$context['post_topic'][] = array(
'id' => $row['id'],
'titulo' => $row['titulo'],
'contenido' => $row['contenido'],
'categoria' => $row['categoria'],
'id_user' => $row['id_user'],
'user_name' => $row['user_name'],
'fecha' => $row['fecha'],
'avatar' => $row['avatar'],
'rango' => $row['rango'],
'usuario' => $row['usuario'],
);
}
mysql_free_result($request);
foreach ($context['post_topic'] as $post_topic){
echo '<div id="foro-p" class="rounded">
<div class="profile">
<div class="img"><img width="80" src="'.$post_topic['avatar'].'" /></div>
<div class="conectado" title="Online"></div>
<div class="nick">'.$post_topic['usuario'].'</div>
<div class="rango">('.$post_topic['rango'].')</div>
</div>
<div class="user-content">
<div class="globit rounded">#1 Publicado hace 30 dias</div>
<div id="cm1">'.showBBcodes($post_topic['comentario']).'</div>
</div>
<div class="clearfix"></div>
<div class="option"><a onClick="doAddTags2(\''.$post_topic['usuario'].'\',\'cm1\',\'comentario\')">Responder</a></div>
</div>';
}
}