Jump to content

Help inserting data into mysl


graham23s

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/66781-help-inserting-data-into-mysl/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.