Wrong Duplication on insertion using foreach function
<p>i have this piece of code which permits me to insert on the database some information:</p>

<pre><code>$att_id=$_REQUEST['att_id'];

$date=$_REQUEST['date'];
$pdv=$_REQUEST['checkbox'];

foreach($date as $val) {
foreach ($pdv as $pdv1) {
$values_arr[] = "('" . $val . "','" . $pdv1 . "','" . $att_id . "')";

$values = implode(", ", $values_arr);

$sql="INSERT INTO date_pdv (date,id_pdv,att_id) VALUES $values";
mysql_query($sql)or die(mysql_error());
}
}
</code></pre>

<p>Now, the points is that if array date has this values [1,2] and array pdv has this ones [1,2,3] what i should get in the database is:</p>

<pre><code>1-1
1-2
1-3
2-1
2-2
2-3
</code></pre>

<p>But i don't... i get repeated values on the database... Should i be using any while length of the array..etc etc?
Thanks!</p>
