Jump to content

Archived

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

vidyashankara

PHP code Error...

Recommended Posts



[code]

$atomstart=  preg_replace('/^(?!ATOM).*?(?:\n|$)/m','',$contents);
$atomarray = explode("\n", $atomstart);

for ($i=0; $i<count($atomarray); $i++) {
   preg_match_all("/([^ \r\n]+)(?:[ ]+)*/", $atomarray[$i], $m);
   $atommatches[$i] = $m[1];
   $atom[$i] = $m[1][4];
}


$atom = array_unique($atom);
sort($atom);

$atm = count($atom);
$atms = implode(", ", $atom);



[/code]


something is wrong in the for loop. If i echo something before it, it shows up, it i echo something after it, it doesnt.

Share this post


Link to post
Share on other sites
are you receiving an error message? What are you trying to echo? A variable or just any crap

Share this post


Link to post
Share on other sites
[!--quoteo(post=382045:date=Jun 9 2006, 04:37 PM:name=Fyorl)--][div class=\'quotetop\']QUOTE(Fyorl @ Jun 9 2006, 04:37 PM) [snapback]382045[/snapback][/div][div class=\'quotemain\'][!--quotec--]
are you receiving an error message? What are you trying to echo? A variable or just any crap
[/quote]

am not receiving any error msg. I echoed just some crap like 123. 123 shows up before the for function, but not after the for function.

Share this post


Link to post
Share on other sites
stick an echo inside the loop spitting like echo $atommatches[$i] . '<br />' and see what it gives you

Share this post


Link to post
Share on other sites
[!--quoteo(post=382048:date=Jun 9 2006, 04:43 PM:name=Fyorl)--][div class=\'quotetop\']QUOTE(Fyorl @ Jun 9 2006, 04:43 PM) [snapback]382048[/snapback][/div][div class=\'quotemain\'][!--quotec--]
stick an echo inside the loop spitting like echo $atommatches[$i] . '<br />' and see what it gives you
[/quote]

I get a blank screen. I have the same script included in the main script right before this script. But i have no problem with tha script. The 2 script are exactly the same, except for the variables except of $i, i figured that should be a problem, because i have twice in the same script and it doesnt give me a error.

Share this post


Link to post
Share on other sites
comment out lines in the loop and starting from the bottom to see which ones cause the screen to blank

Share this post


Link to post
Share on other sites
[!--quoteo(post=382054:date=Jun 9 2006, 04:52 PM:name=Fyorl)--][div class=\'quotetop\']QUOTE(Fyorl @ Jun 9 2006, 04:52 PM) [snapback]382054[/snapback][/div][div class=\'quotemain\'][!--quotec--]
comment out lines in the loop and starting from the bottom to see which ones cause the screen to blank
[/quote]

I commented out
$atommatches[$i] = $m[1];

But the output isnt right, It processes till the end of the included script. Then it doesnt process the actual script.

[!--quoteo(post=382059:date=Jun 9 2006, 04:59 PM:name=Vids)--][div class=\'quotetop\']QUOTE(Vids @ Jun 9 2006, 04:59 PM) [snapback]382059[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I commented out
$atommatches[$i] = $m[1];

But the output isnt right, It processes till the end of the included script. Then it doesnt process the actual script.
[/quote]

actually the rest of the script works fine now. just the included script doesnt function. there is something wrong with the $atommatches line.

Share this post


Link to post
Share on other sites

×

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.