foreach ($div->find('table[class=items]') as $table) { foreach (array_slice($table->find('tr'), 2) as $tr) { //echo $tr."<br>"; $tm_id = $tr->find('a[class=vereinprofil_tooltip]', 1)->id; $row->getTMTeamId($conn, $tm_id); $row->league_id = $league_id; $row->year = $year; //check if table row has been inserted already if ($row->TMrowInserted($conn)) { //one for each input $Players_Num = $tr->find('td', 3)->plaintext; $input_name = "Number Of Players"; $row->input_id = getInputId($conn, $input_name, "Social", 0, "number"); $row->value = $Players_Num; if ($conn->query($row->insertQuery())) { $row->insertMessage($input_name); } $AgeAVG = floatval(str_replace(",", ".", $tr->find('td', 4)->plaintext)); $input_name = "Average Age"; $row->input_id = getInputId($conn, $input_name, "Social", 0, "number"); $row->value = $AgeAVG; if ($conn->query($row->insertQuery())) { $row->insertMessage($input_name); } $Foreign = $tr->find('td', 5)->plaintext; $input_name = "Number Of Foreign Players"; $row->input_id = getInputId($conn, $input_name, "Social", 0, "number"); $row->value = $Foreign; if ($conn->query($row->insertQuery())) { $row->insertMessage($input_name); }
echo '<div class="row"><div class="col-md-6">'; echo "<b>Parsing transfermarkt stadiums </b><br>"; //result $input_id = getInputId($conn, "Stadium Capacity", "Social", 0, "number"); foreach ($html->find('table[class=items]') as $table) { echo "<br>New League<br>"; foreach (array_slice($table->find('tr'), 1) as $tr) { foreach ($tr->find('table') as $tab) { $tm_id = $tab->find('a', 1)->id; } $value = $tr->find('td[class=rechts]', 0)->plaintext * 1000; if ($value > 0) { //echo "$tm_id----------$value "; $row = new DataRow(); $row->getTMTeamId($conn, $tm_id); if ($row->team_id > 0) { $row->value = $value; $row->input_id = $input_id; echo $row->fixedInsertQuery() . " "; if ($conn->query($row->fixedInsertQuery())) { $row->insertMessage("Stadium Capacity"); } } echo "<br>"; } } } echo '</div><div class="col-md-6">'; echo "Done Parsing<br>"; echo '<a href="home.html#thirteen" class="btn btn-info" role="button">Continue</a>'; echo '</div></div>';