I'm trying to find out all of my "Likes" from a mysql table and to put them into an array but I'm really not sure if I'm doing it right as I keep getting a "Wrong Datatype" error. Here is my code:
<?php
$check_like_sql = "SELECT * FROM posts WHERE type = 'Like' && poster = '$yourid'";
$check_like_res = mysqli_query($con, $check_like_sql) or die (mysqli_error());
if(mysqli_affected_rows($con)>0){
while($likes = mysqli_fetch_assoc($check_like_res)){
$yourlike = $likes['media'];
}
$likearray = mysqli_fetch_array($con, $yourlike);
}
?>
<?php
if(in_array($likearray, $postid)) {
$likethis = "<a href=\"php/unlike.php?poster=$yourid&post=$postid\">Unlike</a> . ";
}
else if($posttype == "Like"){
$likethis = "";
}
else{
$likethis = "<a href=\"php/like.php?poster=$yourid&lat=$yourlat&lon=$yourlon&like=$postid&user=$postusername\">Like</a> . ";
}
?>
Could anyone please explain where there might be an error? I'm very new to this sort of php coding. Thanks
mysqli_fetch_array($con, $yourlike);? see mysqli_fetch_array$postid?? and from where the value is assigned