PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$query = "SELECT DATE_FORMAT(commentdate, '%M %D, %Y - %l:%i %p'), username, comment, commentID FROM
comments WHERE postID='$id' ORDER BY commentdate DESC";
$result = @mysql_query($query) or die(mysql_error());
$num = mysql_num_rows($result);
if ($num > 0)
{
$uname = $_SESSION['firstname'];
//report edit
$editquery = "SELECT postID, username, commentID FROM comments
WHERE postID='$id' AND username='$uname'";
$editresult = @mysql_query($editquery) or die(mysql_error());
if ($row = mysql_fetch_assoc($editresult))
{
$edit = '<a href="reportcommentedit.php?eid='.$_GET['pid'].'&cid='.$row['commentID'].'" class=under>EDIT</a>';
}
else
{
$edit = ' ';
}
this is to get both the eid and the cid from here to another page...it works...but the problem is that when there are 2 or more edit link, their cid is the same....so when i edit the the last comment, the it is changing the first comment, and not the current comment....i know there's something wrong about my query...can you help me guys?
thanks feyd...yes, line 15 is not showing correclty and the edit page...when, for example, i have 2 edit links, they both show the same cid, the value of the first comment is "apple", the 2nd is "banana", apple is the latest comment posted, when i click the edit of the 2nd comment, which is banana, the edit form loads and the value of the textarea is apple...