Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $pathToFile = $_POST['file'];
- $dataFromFile = file($pathToFile);
- $pdo = new \PDO('dsn');
- foreach ($dataFromFile as $line) {
- $pdo->exec("INSERT INTO test_table (val1, val2) VALUES ($line[1], $line[2])");
- if (!empty($line[1])) {
- $items = $pdo->query("SELECT * FROM test_table2 WHERE any_filed=$line[1]")
- ->fetchAll();
- foreach ($items as $item) {
- $children = $pdo->query("SELECT * FROM test_table3 WHERE filed={$item['name']}")
- ->fetchAll();
- $pdo->exec("INSERT INTO test_logs (val1, val2) VALUES ($children[0], $children[1])");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement