Commit c785268f authored by root's avatar root
Browse files

display comments for the admin

parent 7e453099
......@@ -155,7 +155,47 @@ function postOpinion($conn){
}
$VIEW['MAIN'].=$item.
HTMLclosingtag("ul");
}
/**
* Display all comments
*
* @param $conn : A valid database PDO connection
*/
function showAllComments($conn){
global $VIEW;
$stmt = $conn->prepare("select * from comments ");
$stmt->execute();
$result = $stmt->setFetchMode(PDO::FETCH_ASSOC);
$VIEW['MAIN'].= HTMLbr().HTMLbr().HTMLbr().HTMLbr().
HTMLp("The users comments !",array("class"=>"alert alert-dark","style"=>"color:black !important;width:50%;margin-left:25%;")).
HTMLtag("ul",array("class"=>"list-group", "style"=>"max-width:70%;margin-left:15%"));
$item="";
while($line=$stmt->fetch()){
$item.= HTMLtag("li",array("class"=>"list-group-item", "style"=>"color:black !important; text-align:left;")).
"<h3 style=\"color:black !important;\">".
""."Comment : ".$line["content"].
"</h3>";
$stmt = $conn->prepare("select users.name from users join comments as s on users.id=s.iduser where s.iduser=:id");
$stmt->bindParam(':id', $line["iduser"], PDO::PARAM_STR);
$stmt->execute();
$result = $stmt->setFetchMode(PDO::FETCH_ASSOC);
$line=$stmt->fetch();
$item.=
"<h3 style=\"color:black !important; padding-left: 86%;\">".
""."Author : ".$line['name'].
"</h3>".
HTMLclosingtag("li");
}
$VIEW['MAIN'].=$item.
HTMLclosingtag("ul");
}
?>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment