From 9dffa8c5d9bb0e55713a1c8943cfa79836ec48b9 Mon Sep 17 00:00:00 2001 From: Alexander Date: Wed, 7 Aug 2024 12:29:05 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D1=8B?= =?UTF-8?q?=20=D0=B2=D1=81=D0=B5=D0=BC=D0=B8=20=D0=B7=D0=B0=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D1=8F=D0=BC=D0=B8=20=D0=BD=D0=B5=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=88=D0=BB=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parser.php | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) 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