Hallo liebes Team,
ich versuche eine XML Datei in eine Datenbank zu überführen, dabei triff folgendes Phenomän auf, es werden Filme, Schauspieler u.s.w. in die Datenbank übergeben, wenn ein Film nur einen Schauspieler hat, dann wird nur der erste Buchstabe in die Tabelle übernommen und die actorID ist auch falsch.
Das Resultat des Import sieht so aus:
Import wird durchgeführt...
Array ( [0] => Tasha Hunter [1] => Ryan [2] => Alana Evans [3] => Chris Mountain [4] => Elizabeth Lawrence [5] => Ana nova ) Array ( [0] => Tristan [1] => Melissa Milano [2] => Lena Juliette [3] => Paola Rey [4] => Jasmine Byrne [5] => Neveah [6] => Jackie Diaz [7] => Vanessa Figueroa [8] => Paige Taylor [9] => Alexis Love ) Array ( [0] => Peaches [1] => Shorty [2] => Reggie [3] => G-Man [4] => Foxey [5] => Pretty Tony ) Array ( [0] => Ginger Lynn [1] => Viper [2] => Billy Dee [3] => Sharon Mitchell [4] => Marc Wallace [5] => Jerry Butler [6] => Kristara Barrington [7] => Rick Savage [8] => Harry Reems [9] => Greg Rome [10] => Dan T. Mann [11] => Sandy Taylor [12] => Crystal Loving [13] => Danica Rae [14] => Debbie Does [15] => Don Osmand ) Array ( [0] => Tony Cappuci [1] => Jake Cruise ) Array ( [0] => Mark Wood [1] => Lee Bang [2] => Alex Gonz [3] => Kitty Wildwood [4] => Britney Blew [5] => Mimi Allen [6] => C-Lo [7] => Nikki Vee [8] => Jessie Electra ) Array ( [0] => Bunny Bleu [1] => Taija Rae [2] => Honey Wilder [3] => Janey Robbins ) Array ( [0] => Brooke [1] => Alexis May [2] => Keiran Lee [3] => Alysha Tyler [4] => Jez Christ [5] => Simon Girth ) Array ( [0] => Amile Waters [1] => Ms. Platinum [2] => Jordan Skye [3] => Gorgeouz ) Array ( [0] => Tristan [1] => Lindsey Meadows [2] => Kacey Villainess [3] => lielani [4] => Jocelyn Jayden [5] => Priscilla Milan [6] => Italia Christie [7] => Joey Ray [8] => Barry Scott [9] => Derrick Pierce [10] => Johnny Sins [11] => Big Pike ) Array ( [0] => Max Hardcore [1] => Vivian [2] => Candi Cash ) Array ( [0] => Eva [1] => Lucky [2] => Iveta [3] => Erik [4] => Mirek [5] => Jerry Harris [6] => Rado [7] => Hans Strong [8] => Carlo Horky [9] => Idka [10] => Alexa Bold ) Array ( [0] => Nyomi Marcela [1] => Sandra Romain [2] => Harmony [3] => Faith Leon [4] => Cassandra Cruz [5] => Misty Stone [6] => Bree Olson [7] => Erika Vution [8] => Lauren Vaughn ) Array ( [0] => Chayse Evans [1] => Kalee Hunter [2] => Tera Dice [3] => Tara Bentley [4] => Alyssa Hall ) Array ( [0] => Sean Michaels [1] => Lili Marlene [2] => Summer Rose [3] => Paul Thomas [4] => Carol Cummings [5] => Saki [6] => Sabrina Dawn [7] => Dan Mann ) Array ( [0] => Mistress D [1] => Jimmy Broadway ) Array ( [0] => Jill Kelly [1] => Vince Vouyer ) Array ( [0] => Lena [1] => Klava [2] => Jerry Geroshvile [3] => Nina Saley [4] => Ulia Butina [5] => Kalina Sharina [6] => Tonova Taisia ) Array ( [0] => Rene Morgan [1] => Whitney Prescott [2] => Doreen Lazlo ) Array ( [0] => Kalena Rios (TVTS) [1] => Cinthya Maia [2] => Priscila Ferrari [3] => Anytha Cordeiro [4] => Fernanda Alencar ) Array ( [0] => Mistress Jade Indica [1] => Slave Liam [2] => Liam [3] => Jade Indica ) Array ( [0] => Julian [1] => Kandi Peach ) NaomiArray ( [0] => Cindy [1] => Allison Wyte [2] => Rick Masters [3] => Layla Rivera [4] => Summer Luv [5] => Honey B [6] => Katio Kailin ) Array ( [0] => Lynden Johnson [1] => Jaye Milo [2] => Brittany O\'Neil [3] => Angel Bust [4] => Randy Spears [5] => Tom Byron [6] => Mike Horner ) Array ( [0] => Mia Smiles [1] => Mika Tan [2] => Jasmine [3] => Lyla Lei [4] => May [5] => Naomi [6] => Saphire [7] => Dana Vespoli [8] => Tami Lynn [9] => Connie [10] => Carman Sancha [11] => Ayoko [12] => Kyanna Lee [13] => Niya Yu [14] => Luci Thai ) . . .
An der Stelle, die ich Fett markiert habe tritt der Fehler auf, wie man sieht ist auch kein array erzeugt worden. Zum Import benutze ich folgende Scripts:
Alles anzeigen
Alles anzeigen
. . .fortsetzung im nächsten Post
ich versuche eine XML Datei in eine Datenbank zu überführen, dabei triff folgendes Phenomän auf, es werden Filme, Schauspieler u.s.w. in die Datenbank übergeben, wenn ein Film nur einen Schauspieler hat, dann wird nur der erste Buchstabe in die Tabelle übernommen und die actorID ist auch falsch.
Das Resultat des Import sieht so aus:
Import wird durchgeführt...
Array ( [0] => Tasha Hunter [1] => Ryan [2] => Alana Evans [3] => Chris Mountain [4] => Elizabeth Lawrence [5] => Ana nova ) Array ( [0] => Tristan [1] => Melissa Milano [2] => Lena Juliette [3] => Paola Rey [4] => Jasmine Byrne [5] => Neveah [6] => Jackie Diaz [7] => Vanessa Figueroa [8] => Paige Taylor [9] => Alexis Love ) Array ( [0] => Peaches [1] => Shorty [2] => Reggie [3] => G-Man [4] => Foxey [5] => Pretty Tony ) Array ( [0] => Ginger Lynn [1] => Viper [2] => Billy Dee [3] => Sharon Mitchell [4] => Marc Wallace [5] => Jerry Butler [6] => Kristara Barrington [7] => Rick Savage [8] => Harry Reems [9] => Greg Rome [10] => Dan T. Mann [11] => Sandy Taylor [12] => Crystal Loving [13] => Danica Rae [14] => Debbie Does [15] => Don Osmand ) Array ( [0] => Tony Cappuci [1] => Jake Cruise ) Array ( [0] => Mark Wood [1] => Lee Bang [2] => Alex Gonz [3] => Kitty Wildwood [4] => Britney Blew [5] => Mimi Allen [6] => C-Lo [7] => Nikki Vee [8] => Jessie Electra ) Array ( [0] => Bunny Bleu [1] => Taija Rae [2] => Honey Wilder [3] => Janey Robbins ) Array ( [0] => Brooke [1] => Alexis May [2] => Keiran Lee [3] => Alysha Tyler [4] => Jez Christ [5] => Simon Girth ) Array ( [0] => Amile Waters [1] => Ms. Platinum [2] => Jordan Skye [3] => Gorgeouz ) Array ( [0] => Tristan [1] => Lindsey Meadows [2] => Kacey Villainess [3] => lielani [4] => Jocelyn Jayden [5] => Priscilla Milan [6] => Italia Christie [7] => Joey Ray [8] => Barry Scott [9] => Derrick Pierce [10] => Johnny Sins [11] => Big Pike ) Array ( [0] => Max Hardcore [1] => Vivian [2] => Candi Cash ) Array ( [0] => Eva [1] => Lucky [2] => Iveta [3] => Erik [4] => Mirek [5] => Jerry Harris [6] => Rado [7] => Hans Strong [8] => Carlo Horky [9] => Idka [10] => Alexa Bold ) Array ( [0] => Nyomi Marcela [1] => Sandra Romain [2] => Harmony [3] => Faith Leon [4] => Cassandra Cruz [5] => Misty Stone [6] => Bree Olson [7] => Erika Vution [8] => Lauren Vaughn ) Array ( [0] => Chayse Evans [1] => Kalee Hunter [2] => Tera Dice [3] => Tara Bentley [4] => Alyssa Hall ) Array ( [0] => Sean Michaels [1] => Lili Marlene [2] => Summer Rose [3] => Paul Thomas [4] => Carol Cummings [5] => Saki [6] => Sabrina Dawn [7] => Dan Mann ) Array ( [0] => Mistress D [1] => Jimmy Broadway ) Array ( [0] => Jill Kelly [1] => Vince Vouyer ) Array ( [0] => Lena [1] => Klava [2] => Jerry Geroshvile [3] => Nina Saley [4] => Ulia Butina [5] => Kalina Sharina [6] => Tonova Taisia ) Array ( [0] => Rene Morgan [1] => Whitney Prescott [2] => Doreen Lazlo ) Array ( [0] => Kalena Rios (TVTS) [1] => Cinthya Maia [2] => Priscila Ferrari [3] => Anytha Cordeiro [4] => Fernanda Alencar ) Array ( [0] => Mistress Jade Indica [1] => Slave Liam [2] => Liam [3] => Jade Indica ) Array ( [0] => Julian [1] => Kandi Peach ) NaomiArray ( [0] => Cindy [1] => Allison Wyte [2] => Rick Masters [3] => Layla Rivera [4] => Summer Luv [5] => Honey B [6] => Katio Kailin ) Array ( [0] => Lynden Johnson [1] => Jaye Milo [2] => Brittany O\'Neil [3] => Angel Bust [4] => Randy Spears [5] => Tom Byron [6] => Mike Horner ) Array ( [0] => Mia Smiles [1] => Mika Tan [2] => Jasmine [3] => Lyla Lei [4] => May [5] => Naomi [6] => Saphire [7] => Dana Vespoli [8] => Tami Lynn [9] => Connie [10] => Carman Sancha [11] => Ayoko [12] => Kyanna Lee [13] => Niya Yu [14] => Luci Thai ) . . .
An der Stelle, die ich Fett markiert habe tritt der Fehler auf, wie man sieht ist auch kein array erzeugt worden. Zum Import benutze ich folgende Scripts:
Quellcode
Quellcode
- <?php
- set_time_limit(0);
- require_once 'simplexml.class.php';
- $file = 'http://www.roter-planet.de/import.xml';
- $sxml = new simplexml;
- $data = $sxml->xml_load_file($file,"array");
- include 'dbconnect.php';
- $find[] = "<b>";
- $replace[] = "ß";
- $data = str_replace($find, $replace, $data);
- $find[] = "</b>";
- $replace[] = "ß";
- $data = str_replace($find, $replace, $data);
- foreach ($data["dvds"]["dvd"] as $dvd)
- {
- $videoID = (int)trim($dvd["videoID"]);
- $title = trim($dvd["title"]);
- $description = trim($dvd["description"]);
- $weight = (int)trim($dvd["weight"]);
- $studioTitle = trim($dvd["studioTitle"]);
- $releaseDate = $dvd["releaseDate"];
- $find[550] = " ";
- $replace[550] = "-";
- $releaseDate = str_replace($find, $replace, $releaseDate);
- $find[550] = ":";
- $replace[550] = "-";
- $releaseDate = str_replace($find, $replace, $releaseDate);
- $thumbUncensored = trim($dvd["images"]["thumbUncensored"]);
- $coverUncensored = trim($dvd["images"]["coverUncensored"]);
- $thumbCensored = trim($dvd["images"]["thumbCensored"]);
- $coverCensored = trim($dvd["images"]["coverCensored"]);
- $find[] = "%";
- $replace[] = " Prozent";
- $title = str_replace($find, $replace, $title);
- $find[] = "ß";
- $replace[] = "ß";
- $title = str_replace($find, $replace, $title);
- $find[] = "ä";
- $replace[] = "ä";
- $title = str_replace($find, $replace, $title);
- $find[] = "ö";
- $replace[] = "ö";
- $title = str_replace($find, $replace, $title);
- $find[] = "ü";
- $replace[] = "ü";
- $title = str_replace($find, $replace, $title);
- $find[] = "“";
- $replace[] = "\"";
- $title = str_replace($find, $replace, $title);
- $find[] = "”";
- $replace[] = "\"";
- $title = str_replace($find, $replace, $title);
- $find[] = "'";
- $replace[] = "";
- $title = str_replace($find, $replace, $title);
- $find[] = "'";
- $replace[] = "";
- $description = str_replace($find, $replace, $description);
- $find[] = "\'";
- $replace[] = "";
- $description = str_replace($find, $replace, $description);
- $find[] = "\\";
- $replace[] = "";
- $description = str_replace($find, $replace, $description);
- $find[] = "'";
- $replace[] = "";
- $studioTitle = str_replace($find, $replace, $studioTitle);
- $sql = "REPLACE INTO movies (title, videoID, description, studioTitle, releaseDate, thumbUncensored, coverUncensored, thumbCensored, coverCensored) VALUES ('$title', $videoID, '$description', '$studioTitle', '$releaseDate', '$thumbUncensored', '$coverUncensored', '$thumbCensored', '$coverCensored')";
- mysql_query($sql) or die(mysql_error());
- $newMovieID = mysql_insert_id();
- $actorNames = $dvd["actorInformation"]["actorNames"]["actorName"];
- $actorIDs = $dvd["actorInformation"]["actorIDs"]["actorID"];
- $catNames = $dvd["categoryInformation"]["mainCategoriesGerman"]["mainCategoryGerman"];
- $subcatNames = $dvd["categoryInformation"]["subCategoriesGerman"]["subCategoryGerman"];
- print_r($actorNames);
- for ($i = 0, $c = count($actorNames); $i < $c; $i++)
- {
- $name = $actorNames[$i];
- $externalID = (int)trim($actorIDs[$i]);
- $sql = "REPLACE INTO actors (name, actorID, videoID) VALUES ('$name', '$externalID', '$videoID')";
- mysql_query($sql) or die(mysql_error());
- $newActorID = mysql_insert_id();
- $sql = "REPLACE INTO actorsmovies (actorID, movieID) VALUES ('$newActorID','$newMovieID')";
- mysql_query($sql) or die(mysql_error());
- }
- for ($i = 0, $c = count($catNames); $i < $c; $i++)
- {
- $cat = $catNames[$i];
- $sql = "INSERT INTO cat (catName, videoID) VALUES ('$cat', $videoID)";
- mysql_query($sql) or die(mysql_error());
- //print_r($sql);
- $newsubcatID = mysql_insert_id();
- $sql = "INSERT INTO catmovies (catID, movieID, videoID) VALUES ($newsubcatID,$newMovieID,$videoID)";
- //print_r($sql);
- mysql_query($sql) or die(mysql_error());
- }
- for ($i = 0, $c = count($subcatNames); $i < $c; $i++)
- {
- $subcat = trim($subcatNames[$i]);
- $sql = "INSERT INTO subcat (subcatName, videoID) VALUES ('$subcat', $videoID)";
- mysql_query($sql) or die(mysql_error());
- $newcatID = mysql_insert_id();
- $sql = "INSERT INTO subcatmovies (subcatID, movieID, videoID) VALUES ($newcatID,$newMovieID,$videoID)";
- //print_r($sql);
- mysql_query($sql) or die(mysql_error());
- }
- }
- echo "IMPORT 1 ERFOLGREICH!<br>";
- mysql_close();
- ?>
- <style type="text/css">
- .txt{
- font-family:Arial, Helvetica, sans-serif;
- font-size:12px;
- }
- #box{
- width:700px;
- border:1px solid #000;
- padding:10px;
- }
- </style>
. . .fortsetzung im nächsten Post
Man muss nicht wissen wie es geht, man muss nur wissen wo es steht! Natürlich bei easy-coding
de

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von kingluui ()