$sql = "SELECT distinct image, posts.imagesid, multiple_image.imagesid, comment
FROM multiple_image JOIN posts ON (multiple_image.imagesid=posts.imagesid)";
Add keyword "distinct" in above query
(or) add extra line with keyword "Group by" as below
$sql = "SELECT image, posts.imagesid, multiple_image.imagesid, comment
FROM multiple_image JOIN posts ON (multiple_image.imagesid=posts.imagesid)
GROUP by image, posts.imagesid, multiple_image.imagesid, comment";