I'm developing a social media for uploading videos and under a video the user could like/dislike the video. Now, I've created a table called "reactions" with the following rows; video_id, video_reaction, video_author_id. Video_id is the ID of the video, video reaction is a tinyint (1 = like, 0 = dislike) and video_author_id is the ID of who liked/disliked the video. So I'm trying to count the rows to see all the likes, this is what I've done in PHP;
$video_id = 1;
// find out likes
$likes = $link->prepare("SELECT COUNT(*) FROM reactions WHERE reaction = 1 && video_id = ?;
");
$likes->bind_param("s", $video_id);
$likes->execute();
$result = $likes->get_result();
while ($rows = $result->fetch_assoc()) {
$likes = $rows["??????"];
}
I don't know what to put in the $rows[] to get the number of columns where the reaction is 1 and the video_id is 1. Help me please.