Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
druid-public
headwork
Commits
c785268f
Commit
c785268f
authored
Aug 10, 2018
by
root
Browse files
display comments for the admin
parent
7e453099
Changes
1
Hide whitespace changes
Inline
Side-by-side
opinion.php
View file @
c785268f
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment