/    Sign up×
Community /Pin to ProfileBookmark

Reply not working on previous comment

See this link (please refresh after submit reply): [url]http://bdshowbiz.com/loginfinal/demo.php[/url]

Here reply only work in last/new comment. if i reply others comment its show a blank space only in text area.

Test case: If I replace reply form at end of wall.php page, apply css display:block to show it always, click a reply button for parent id and submit after write any text then it work but reply button click cannot open to it’s own reply form.

Where/What is my problem in this code, how to solved it.

wall.php
<script type=’text/javascript’>
$(function(){
$(“a.reply”).click(function() {
var id = $(this).attr(“id”);
$(“#parent_id”).attr(“value”, id);
});
});
</script>

<script>
$(‘a.reply’).livequery(“click”,function() {
var ID = $(this).attr(‘id’).replace(”,”);
$(“#reply_here-“+ID).slideToggle(‘slow’);
return false;
});
</script>
</head>

global $dbh;
$results = mysqli_query($dbh,”SELECT * FROM comments_lite WHERE qazi_id=’$tutid’ ORDER BY id DESC LIMIT 5″) or die(mysqli_error($dbh));
//find the number of comments
list($commentNum) = mysqli_fetch_array(mysqli_query($dbh,”SELECT COUNT(*) FROM comments_lite WHERE qazi_id=’$tutid'”));

echo'<div class=”comments”><div id=”updates”><div class=”content”><comment>’;

while($rows = mysqli_fetch_array($results))
{
$id = $rows[‘id’];
$qazi_id = $rows[‘qazi_id’];
$likes = $rows[‘likes’];
$username = $rows[‘username’];
$img = $rows[‘img’];
$description = $rows[‘description’];

$url = $rows[‘url’];
$parent_id = $rows[‘parent_id’];
$date = $rows[‘date’];

echo'<div class=”comment”>
<div class=”cdomment_cheder”>’;
if ($url==””) {
echo'<p class=”name”>’.$username.’ Says:</p>’; }
else echo'<p class=”name”><a href=”userinfo.php?user=’.$url.'” title=”‘.$username.'”>’.$username.'</a> Says:</p>’;
echo'<span class=”cdomment_time”>’.$date.'</span><br/>
<div class=”avatarcnt”>
<img alt=”” src=”uploadprofile/’.$u_imgurl.'”/>
</div></div></div>
<div class=”cdomment_text”>’;
if ($description==””) {echo ”;}
else echo”.htmlentities($description).'<br>’;
echo ‘</div>’;

//reply
echo'<div class=”reply_box”><a href=”javascript: void(0)” class=”reply” id=”‘.$id.'”>Reply</a></div>’;

//Likes
echo'<div></div>’;

// Only Reply
$query = “SELECT * FROM comments_reply WHERE parent_id ='”.$id.”‘ ORDER BY id DESC”;
$res = mysqli_query($dbh,$query);
while($row = mysqli_fetch_array($res))
{ $id = $row[‘id’];
$qazi_id = $row[‘qazi_id’];
$likes = $row[‘likes’];
$username = $row[‘username’];
$img = $row[‘img’];
$description = $row[‘description’];

$url = $row[‘url’];
$parent_id = $row[‘parent_id’];
$date = $row[‘date’];

echo’ <div class=”rcontent”><replycomment><ul>
<div class=”comment”>
<div class=”cdomment_cheder”>’;
if ($url==””) {
echo'<p class=”name”>’.$username.’ Says:</p>’; }
else echo'<p class=”name”><a href=”userinfo.php?user=’.$url.'” title=”‘.$username.'”>’.$username.'</a> Says:</p>’;
echo'<span class=”cdomment_time”>’.$date.'</span><br/>
<div class=”avatarcnt”>
<img alt=”” src=”uploadprofile/’.$u_imgurl.'”/>
</div></div></div>
<div class=”cdomment_text”>’;
if ($description==””) {echo ”;}
else echo”.htmlentities($description).'<br>’;
echo ‘</div>’;

</ul><replycomment></div>’;

} //reply close

?>
<div id=”loader”></div><div class=”reply_here” id=”reply_here-<?php echo $rows[‘id’] ?>” style=”display:none;”>
<form action=”” method=”post” id=”repfrm”>
<fieldset id=”cmntfs”>
<legend class=”pyct”>Your comment</legend>
<input type=”hidden” name=”username” id=”author” value=”<?php echo $_SESSION[‘username’] ?>”/>
<input type=”hidden” name=”url” id=”url” value=”” />
<div id=”maintbox”>
<textarea name=”replycom” rows=”2″ id=”replycom”></textarea>
</div>
<input type=”hidden” name=”parent_id” id=”parent_id” value=”0″ />
<input type=”hidden” name=”tutid” id=”tutid” value=”<?php echo $tutid ?>” />
<button type=”submit” name=”submit” value=”” id=”submit” class=”repfrm”>Post Reply</button>
</fieldset>
</form>
</div>
<?
} //comment close

echo'</div><comment></div>’;

//pagination

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @jainul spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...