Okay so I created a script that stores multiple ID's in one field in a sql table. So the ID's look this this in a table 1,2,3(seperated with a comma). I was able to get the ID's using explode because it stores the data in a array, but I wan't to use mysql_num_rows(in a loop) to count how many movies are in a specific genre.


$select_genres = mysql_query("SELECT * FROM genres ORDER BY position") or die(mysql_error());
while($genres = mysql_fetch_array($select_genres)){

$count_movies = mysql_num_rows(mysql_query("SELECT * FROM movies WHERE genre_ids='{$genres['genre_id']}'"));

Basically I don't know how to get the genre id so the mysql_num_rows will run without errors. Anyone know a function or a way to do this?