Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <meta charset="utf-8">
- <head>
- </head>
- <body>
- <?php
- $servername="localhost";
- $username="root";
- $password="";
- $dbname="vod";
- $conn=mysqli_connect($servername,$username,$password,$dbname);
- if($conn)
- {
- $wiersze=file('filmy.txt');
- $n=count($wiersze);
- for($i=0; $i<$n; $i++)
- {
- $tab=explode("\t",$wiersze[$i]);
- for($o=0; $o<5; $o++)
- {
- $tab[$o]=trim($tab[$o]);
- }
- $sql = "INSERT INTO filmy (`id`,`ID_filmu`,`Tytul`,`Kraj_produkcji`,`Gatunek`,`Cena_w_zl`) VALUES(NULL, '".$tab[0]."', '".$tab[1]."', '".$tab[2]."', '".$tab[3]."', '".$tab[4]."');";
- mysqli_query($conn, $sql);
- }
- }
- else
- {
- die("bład połaczenia : " .mysqli_connect_error());
- }
- mysqli_close($conn);
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement