像系统不能正常工作

i have used ajax to load the rating system on my page but it is showing me rating for only 1 post not for other posts

enter image description here

enter image description here

as you can see from the above images it is showing rating for 1 post and not for another and i am sure that my database is filled for both posts

my ajax

<script>
//where $mypostid is already set in my file
function load'.$mypostid.'()
{
    if(window.XMLHttpRequest)
    {
        xmlhttp=new XMLHttpRequest();
    }
    else
    {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
        if(xmlhttp.readyState==4 && xmlhttp.status==200)
        {
            document.getElementById("echoresult'.$mypostid.'").innerHTML=xmlhttp.responseText;
        }
    }
    parameters="id='.$mypostid.'";
    xmlhttp.open("POST","like.php",true);
    xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlhttp.send(parameters);
}
window.addEventListener("load",load'.$mypostid.');
</script>

my like.php

<?php
$connection30=mysqli_connect('localhost','root','123456789','register');
if(isset($_POST['id']))
{$postid=$_POST['id'];
$queryselect=mysqli_query($connection30,"select * from likes where postid='$postid'");
while($rowselect=mysqli_fetch_array($queryselect))
{
    $countlikes=$rowselect['likes'];
    $countdislikes=$rowselect['dislikes'];
    $likepercentage=($countlikes/($countlikes+$countdislikes))*100;
    echo ceil($likepercentage).'% people liked this';
}}
?>

and my div element for displaying rating

<div id="echoresult'.$mypostid.'"></div>