this is a many to many relationship and should be handled with a link table
prod_to_cat
id --> auto_increment
prod_id --> bigint
cat_id --> bigint
Then to look up products in a category just to this
<?php
$sql = "SELECT prod_id FROM prod_to_cat WHERE cat_id = $cat_id";
$query = mysql_query($sql);
?>