Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- </head>
- <body>
- <?php
- $servername="localhost";
- $username="root";
- $password="";
- $dbname="ohayov3";
- $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łąd połączenia : " . mysqli_connect_error());
- }
- mysqli_close($conn);
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement