PDO::ERRMODE_EXCEPTION )); }catch (Exception $e){ die("Error : ".$e->getMessage()); } if (isset($_GET['topic'])){ $topic_id = $_GET['topic']; $req = $db->prepare('SELECT topic_subject FROM topics WHERE id=:id'); $req->execute(array( "id"=>$topic_id )); if ($data = $req->fetch()) { $subject = $data['topic_subject']; } $req = $db->prepare('SELECT * FROM replies WHERE reply_topic=:id_topic'); $req->execute(array( "id_topic"=>$topic_id )); try { $rows = $req->fetchAll(PDO::FETCH_ASSOC); ?>

prepare('SELECT firstname, lastname, username FROM `authors` WHERE id=:user_id'); $req->execute(array( "user_id"=>$reply_by )); if ($data = $req->fetch()) { $username = $data['username']; $firstname = $data['firstname']; $lastname = $data['lastname']; } ?>
$firstname $lastname
($username)"?>
text($row['reply_content'])?>

getMessage()); echo _("Can't fetch topic data.") .'\n'; } } else { $req = $db->prepare('SELECT * FROM `topics`'); $req->execute(); $rows = $req->fetchAll(PDO::FETCH_ASSOC); ?>

Topics

prepare('SELECT firstname, lastname, username FROM `authors` WHERE id=:user_id'); $req->execute(array( "user_id"=>$topic_by )); if ($data = $req->fetch()) { $username = $data['username']; $firstname = $data['firstname']; $lastname = $data['lastname']; } $req = $db->prepare('SELECT COUNT(*) AS counter FROM replies WHERE reply_topic=:reply_topic'); $req->execute(array( "reply_topic"=>$row['id'] )); if ($data = $req->fetch()) { $n_messages = $data['counter']; } ?>