graham23s Posted August 26, 2007 Share Posted August 26, 2007 Hi Guys, i have this piece of code below working great when echoed out displays the files like it should, they can be upto 100 lines depending, what i wanted to do is store ALL the date for "$output" & "$parts" in mysql but it only stores the first line not the rest, if i put my insert query in the foreach it inserts the files but makes an entry for each file (instead of the whole lot in the 1 field) //================================================================================// // Before the insertion get some details... //================================================================================// $filecontent = file_get_contents("nzbs/$renamed_nzb"); $parts = explode("</file>",$filecontent); foreach($parts as $part){ ## get the newsgroup if (eregi ('subject="(.*)">', $part, $matches)) { $titel = $matches[1]; $titel = explode('">', $titel); print('<font face=Verdana size=1>'.$titel[0].""); } if (eregi("<group>(.*)</group>", $part, $matches)) { $ng = $matches[1]; $ng = str_replace("alt.binaries", "a.b", $ng); //echo ("<font face=Verdana size=1>".$ng.""); ## get the poster if (eregi ("poster=\"(.*)\" date=", $part, $matches)) { $poster = $matches[1]; //print("<font face=Verdana size=1>".$poster.""); } if (eregi ("<segment bytes=\"(.*)\" number=", $part, $matches)) { $size = $matches[1]; $size = round($size / 1024,2); $parts = doe_iets($titel[0]); $parts = str_replace("/", "", $parts); $parts = str_replace(")", "", $parts); $output = $parts * $size; print "$output kb $parts"; $total_output = $output; } } } is there a way i can store the whole lot in mysql as 1 long string then ill be able to explode it and display later. thanks for any help guys Graham Quote Link to comment https://forums.phpfreaks.com/topic/66781-help-inserting-data-into-mysl/ Share on other sites More sharing options...
Barand Posted August 26, 2007 Share Posted August 26, 2007 Do you need $total_output .= $output; Quote Link to comment https://forums.phpfreaks.com/topic/66781-help-inserting-data-into-mysl/#findComment-334629 Share on other sites More sharing options...
graham23s Posted August 26, 2007 Author Share Posted August 26, 2007 Hi Barry, that was my desperate attempt lol i thought if i put it in another variable, i could insert that variable into mysql it works but still only inputs the first line. Graham Quote Link to comment https://forums.phpfreaks.com/topic/66781-help-inserting-data-into-mysl/#findComment-334672 Share on other sites More sharing options...
Barand Posted August 26, 2007 Share Posted August 26, 2007 Attach the input file so we can run your code Quote Link to comment https://forums.phpfreaks.com/topic/66781-help-inserting-data-into-mysl/#findComment-334680 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.