I'm trying to determine whether or not the user has voted on a certain item and changing the image for the vote icon accordingly.
$user_likes = mysql_query("SELECT * from ratings WHERE userid = '$uid' AND aggregate = 1");
while ($row_likes = mysql_fetch_array($user_likes)) {
$row_likes['imageid'] = $likes_array;
}
Now in my content, I have a PHP foreach that returns a menu item for each submission (that is what users can vote on), the $image['idnum']
is the ID value for that individual image. The 'ratings' table seen in the query above is where I store votes like this: user id, image id, aggregate (in this case 1, to represent a like). Here is the in_array function that is giving me trouble:
if (in_array($image['idnum'], $likes_array)) {
echo 'vote_triangle.png';
}
I'm getting the following error message:
Warning: in_array() [function.in-array]: Wrong datatype for second argument in (filename) on line 33