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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.