diff --git a/parser.php b/parser.php index caf28e0..4fb47e0 100755 --- a/parser.php +++ b/parser.php @@ -57,7 +57,6 @@ $records = []; $size = []; for ($i = 0; $i < $data['numberAll']->length; $i++) { - $records[]['id'] = $i++; // $sizeFederalBudget->update( // $data['numberBF']->item($i)->textContent, // $data['numberBFF']->item($i)->textContent @@ -95,7 +94,7 @@ for ($i = 0; $i < $data['numberAll']->length; $i++) { } // echo "
";
-// print_r($records);
+// print_r($records[0]);
 // echo "
"; try { @@ -113,14 +112,12 @@ try { $sql = " INSERT INTO sveden_education_contingent ( - id, spec_code, spec_name, edu_level, edu_forms, contingent ) VALUES ( - id, :spec_code, :spec_name, :edu_level, @@ -129,17 +126,19 @@ $sql = " ) "; -echo "
";
-print_r($records[0]);
-echo "
"; -$sth = $pdo->prepare($sql); -try { - $sth->execute($records[0]); -} catch (PDOException $e) { - echo "Ошибка выполнения запроса:". $e->getMessage() . ""; -} +// Почему-то не сработала +// foreach ($records as $record) { +// $sth = $pdo->prepare($sql); +// try { +// $sth->execute($record); +// } catch (PDOException $e) { +// echo "Ошибка выполнения запроса:". $e->getMessage() . ""; +// } +// } $sql = 'SELECT * FROM sveden_education_contingent'; -foreach ($pdo->query($sql) as $row) { - print_r($row); -} \ No newline at end of file +$array = $pdo->query($sql)->fetch(PDO::FETCH_ASSOC); + +echo "
";
+print_r($array);
+echo "
"; \ No newline at end of file