from what i get out of your question. this might help or not?
for each($value as $a){
$sql="insert statement into the db";
$query= query it to db;
}
you just need to make a look that cycles to each of the array elements for your first question. i dont really get what you're trying to say on the second part but i hope this helps, if at all.