here is my code
PHP:--------------------------------------------------------------------------------
for($i=0;$i<=count($category);$i++) {
$cat=$category[$i];
mysql_query("INSERT INTO user_category VALUES ('$user_id[0]','$cat')");}
$user_id[0] is the maximum id which comes from a previous query.
$category is an array which comes from a <select multiple>.
The problem is when the INSERT is being executed always 0 is stored before the $cat follows.
for example
userid - categoryid
32 - 0 <---That is my problem
32 - 2
32 - 3
33 - 0 <---That is my problem
33 - 1
33 - 2
33 - 3
33 - 11