I have code so that users can make comments on a page, they have a choice to have their name displayed or be anonymous. I want to order the comments by the date they were made, and display the name or 'anonymous poster' if they selected anonymous.
So I have this code which grabs everything into an array, but the if statement within the array is not working, in testing, when I select anonymous the page still displays the name of the user. What is the best way around this?
The following code is where I am stuck:
echo "<h3>Comments for this article:</h3>";
echo "<p>".$fetch['comment']."<br/><sub><b>Comment by: </b>'Anonymous Poster'</sub><hr /><p>";
echo "<p>".$fetch['comment']."<br/><sub><b>Comment by: </b>".$fetch['userid']."</sub><hr /><p>";