Sorry maar ik snap echt ni goe wat ge hier allemaal bedoeld.
Code:
//viewing funtion:
function viewComments($id) {
//make larray and sarray awailable:
global $sarray;
global $larray;
//query to check if any comments awailable:
$count_query = "SELECT count(*) FROM {$sarray['table']} WHERE id = '$id'";
$count_query_result = mysql_query($count_query);
$count = mysql_result($count_query_result, 0, 0);
//if there are any registered:
if ($count > 0) {
//get comments from DB:
$query = "SELECT * FROM {$sarray['table']} WHERE id = '$id' ORDER BY time DESC";
$query_result = mysql_query($query) or DIE ("DATABASE ERROR");
//print heading:
print "{$larray['header']}";
//print out the comments:
while ($row = mysql_fetch_array($query_result)) {
print "<hr />
{$row['comment']}<br><br>
{$larray['author']}: {$row['name']}<br><br>
{$larray['ptime']}: ";
print strftime($sarray['tformat'], $row['time']);
print "<br><br>";
//if admin, show links to delete and edit
//print links to edit and delete:
if ($_SESSION['cadmin']) {
print "author e-mail: <a href=\"mailto:{$row['mail']}\">{$row['mail']}</a><br><br>";
print "[<a href=\"spgm_comments.php?edit={$row['cid']}\"
onClick=\"window.open('spgm_comments.php?edit={$row['cid']}', 'edit', 'width=520, height=400'); return false\">
{$larray['editlink']}</a>]
[<a href=\"spgm_comments.php?delete={$row['cid']}\"
onClick=\"window.open('spgm_comments.php?delete={$row['cid']}', 'delete', 'width=520, height=400'); return false\">
{$larray['deletelink']}</a>]
[<a href=\"spgm_comments.php?sensor={$row['cid']}\"
onClick=\"window.open('spgm_comments.php?sensor={$row['cid']}', 'sensor', 'width=520, height=400'); return false\">
{$larray['sensorlink']}</a>]<br><br>";
}
}
}
else {
print "<br><br>{$larray['nocomments']}<br><br>";
}
//print add comment link:
print "<a href=\"URL\"
onClick=\"window.open('spgm_comments.php?add=$id', 'add', 'width=520, height=400'); return false\">
{$larray['addcomment']}</a>";
//print "<br>[<a href=\"spgm_comments.php?add=$id\">{$larray['addcomment']}</a>]";
}
Dit zou de volledige code moeten zijn die nodig is om de reactie's weer te geven. Maar het enige wat er weergegeven wordt is:
Code:
No comments Yet
Add Your Comment
Alvast bedankt