TechieDev 2020-11-02 00:05:14
TechieDev 2020-11-02 00:01:44
Try this
$comment_count=mysqli_num_rows($query);
$comment_count=mysqli_num_rows($query);
$query is your mysqli query variable
TechieDev 2020-11-02 00:06:36
$query=mysqli_query($connect,”Your query to fetch comments”);
$comment_count=mysqli_num_rows($query);
TechieDev 2020-11-02 00:07:22
$comment_count will display the amount of rows/specific post
TechieDev 2020-11-02 00:07:28
Based on your query
puxpyzah 2020-11-02 00:07:58
TechieDev 2020-11-02 00:06:36
$query=mysqli_query($connect,”Your query to fetch comments”);
$comment_count=mysqli_num_rows($query);
Let me send screenshot of my code
TechieDev 2020-11-02 00:08:06
Sure
puxpyzah 2020-11-02 00:15:54

puxpyzah 2020-11-02 00:15:54

puxpyzah 2020-11-02 00:15:55

puxpyzah 2020-11-02 00:15:56

puxpyzah 2020-11-02 00:15:56

puxpyzah 2020-11-02 00:15:56

puxpyzah 2020-11-02 00:15:57

puxpyzah 2020-11-02 00:15:57

puxpyzah 2020-11-02 00:15:57

puxpyzah 2020-11-02 00:15:58

puxpyzah 2020-11-02 00:16:02

puxpyzah 2020-11-02 00:16:03

puxpyzah 2020-11-02 00:26:52
TechieDev 2020-11-02 00:08:06
Sure
Did you see
TechieDev 2020-11-02 00:27:28
puxpyzah 2020-11-02 00:26:52
Did you see
Yes. Wait I’ll check
puxpyzah 2020-11-02 00:27:37
OK
TechieDev 2020-11-02 00:30:02

Define it right here
TechieDev 2020-11-02 00:30:23
$comment_count=mysqli_num_rows($c_run);
TechieDev 2020-11-02 00:30:56
TechieDev 2020-11-02 00:30:23
$comment_count=mysqli_num_rows($c_run);
Updated
TechieDev 2020-11-02 00:32:01
Then you can print or echo it anywhere necessary
Total comments <?php echo $comment_count;?>
Total comments <?php echo $comment_count;?>
puxpyzah 2020-11-02 00:32:49
TechieDev 2020-11-02 00:30:23
$comment_count=mysqli_num_rows($c_run);
I should add it or replace?
TechieDev 2020-11-02 00:32:58
puxpyzah 2020-11-02 00:32:49
I should add it or replace?
Add it
TechieDev 2020-11-02 00:33:12
Add it where I marked
puxpyzah 2020-11-02 00:33:28
TechieDev 2020-11-02 00:33:12
Add it where I marked
Oky
TechieDev 2020-11-02 00:40:14
Did it work?
puxpyzah 2020-11-02 00:42:11
Am just writing it
puxpyzah 2020-11-02 00:44:22
Doesn’t work
TechieDev 2020-11-02 00:44:48
Show me how you defined it
puxpyzah 2020-11-02 00:45:04
Worked thank you so much
TechieDev 2020-11-02 00:49:15
Great
puxpyzah 2020-11-02 00:50:42

But this doesn’t work
puxpyzah 2020-11-02 00:50:43

puxpyzah 2020-11-02 00:50:43

puxpyzah 2020-11-02 00:50:44

puxpyzah 2020-11-02 00:50:44

puxpyzah 2020-11-02 00:52:52
Solved thanks I forgotten to change $c_run to $run🤝👏🙌🤲👐🙏💪
TechieDev 2020-11-02 00:54:11
Great. Incase you need any assistance just write
puxpyzah 2020-11-02 00:54:18

puxpyzah 2020-11-02 00:54:19

TechieDev 2020-11-02 00:56:40
Great
TechieDev 2020-11-02 00:57:05
Make sure you filter the comment.
TechieDev 2020-11-02 00:57:21
So people will not break your website by posting html content as comment
puxpyzah 2020-11-02 01:00:10
TechieDev 2020-11-02 00:57:05
Make sure you filter the comment.
What you mean?
TechieDev 2020-11-02 01:35:43
puxpyzah 2020-11-02 01:00:10
What you mean?
Use htmlspecialchars when displaying post comments
TechieDev 2020-11-02 01:36:11
Well, it’s optional I didn’t know what you’re trying to develop but consider security