I've been looking around for my solution for a while now with no success. I figured i'd ask the elite of web development instead..
I will try to explain this simple.
Array:
$image_exts = array('jpg','jpeg','gif','png', 'bmp','webp');
What i need to do is something like this:
SELECT file_views
FROM files
WHERE file_owner='$user_id'
AND file_ext='$image_exts'
the "file_ext" field in the database can contain "jpg" for one file and "mp4" for another...i only want to count views in this example for images..
Thank you for your time!
Update 2:
function count_totalviews($user_id){
$image_exts = array('jpg','jpeg','gif','png','bmp','webp');
$image_array=implode(",", $image_exts);
$query = mysql_query("SELECT file_views FROM files WHERE file_ext IN ($image_array) AND file_owner='$user_id'");
$count=0;
while($row = mysql_fetch_assoc($query)){
$count = $row['file_views'] + $count;
}
return $count;
}
PHP Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result
No clue what to do...
SELECT file_views FROM files IN($image_exts) WHERE file_owner='$user_id'didnt workWHERE file_owner='$user_id' AND file_ext IN '$image_exts'@Sorcher - That ought to make it kick in.WHERE file_owner='$user_id' AND file_ext IN (".$image_exts.")