Hi again,
I never was really good at this but why is foreach behaving like that?
My code is

function exportDb($array)
{
	global $dbh;
	foreach($array as $soustab) 
	{ 
		list($date,,$de,$a,,,,$temps)=$soustab;
		if(ereg('[0-9]{10}',$date) ==true)
		break;//pour éviter l'insertion multiple, malgré ce qu'affirme la documentation
		$requete = "INSERT INTO t_interurbain(date_appel,de_numero,a_numero,duree)DISTINCT VALUES('$date','$de','$a','$temps')";
		$resultat = mysql_query($requete,$dbh);
		/*$combien = $result->affectedRows();
		echo($combien);*/
	}
}

where the for each is expected to take each subarray and insert it
ounce in the database. Problem is every subarray gets inserted twice! What am i doing wrong?

Merci!
Simon

    Write a Reply...