voila g un problème
j'ouvre un dossier qui contiens des .txt ouvre et lit les .txt en récupère des données.
Des requête s'exécute dans une boucle
j'ai se code qui fonctionne mai il bloc a 84 enregistrement.
quelqu’un pourrai m'expliquer
$dirname = 'import/uploads/';
$dir = opendir($dirname);
while($file = readdir($dir)) {
if($file != '.' && $file != '..' && !is_dir($dirname.$file))
{
$txt = file_get_contents("import/uploads/$file");
$regex = '` Game\s(?<partie>\d+)
`xu';
preg_match_all($regex, $txt, $aMatches);
$combien=count($aMatches['partie'])-1;
for ($i=0;$i<=$combien;$i++)
{
//On en profite pour initialiser les sessions
session_start();
//On se connecte
mysql_connect('db', 'dbo', 'az');
mysql_select_db('db344257153');
$partie = $aMatches['partie'][$i];
$logiciel = 'PartyPoker';
$date = 'teste';
$BBhand = 0;
$bb = 0;
$regex2 = '` Dealt\s[a-zA-Z0-9]+\s[a-zA-Z0-9]+\s\[\s\s(?<main1>[a-zA-Z0-9]+)\s(?<main2>[a-zA-Z0-9]+)`xu';
preg_match_all($regex2, $txt, $Main); $main = $Main['main1'][$i]; $main2 = $Main['main2'][$i];
$regdate = '` ,(?<date>\s[A-Za-z]+\s\d+)`xu';
preg_match_all($regdate, $txt, $Date); $date = $Date['date'][$i];
$regplayer = '` Total.+(?<player>\d+\/\d+)`xu';
preg_match_all($regplayer, $txt, $Player); $joueurs = $Player['player'][$i];
$regblinds = '` (?<blinds>.+)Texas`xu';
preg_match_all($regblinds, $txt, $Blinds); $blinds = $Blinds['blinds'][$i];
$regtable = '` Table\s\s(?<table>\d+).+\((?<game>.+)\)`xu';
preg_match_all($regtable, $txt, $Table); $idtable = $Table['table'][$i]; $game = $Table['game'][$i];
$dn = mysql_num_rows(mysql_query('select id from FL_partypoker where partie="'.$partie.'"'));
if($dn==0){
$dn2 = mysql_num_rows(mysql_query('select `id` from `FL_partypoker`'));
$id = $dn2+1;
mysql_query('INSERT INTO `FL_partypoker` ( id , partie , logiciel , date , joueurs , blinds , bb , main , main2 , idtable , game)
VALUES (
"'.$id.'", "'.$partie.'", "'.$logiciel.'", "'.$date.'", "'.$joueurs.'", "'.$blinds.'", "'.$bb.'", "'.$main.'", "'.$main2.'", "'.$idtable.'", "'.$game.'"
)');}
}
}else { $notif1 = "ok";
$_SESSION['notification1']=$notif1; echo "<script>window.location.replace(\"index.php\")</script>" ;}
}
closedir($dir);