Jump to content


Photo

PHP code Error...


  • Please log in to reply
6 replies to this topic

#1 vidyashankara

vidyashankara
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 09 June 2006 - 07:27 PM




$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);





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

#2 Fyorl

Fyorl
  • Members
  • PipPipPip
  • Advanced Member
  • 273 posts
  • LocationUK

Posted 09 June 2006 - 08:37 PM

are you receiving an error message? What are you trying to echo? A variable or just any crap
[table]



Don't worry, the printer fairies will sort it out.

#3 vidyashankara

vidyashankara
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 09 June 2006 - 08:40 PM

[!--quoteo(post=382045:date=Jun 9 2006, 04:37 PM:name=Fyorl)--][div class=\'quotetop\']QUOTE(Fyorl @ Jun 9 2006, 04:37 PM) View Post[/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.

#4 Fyorl

Fyorl
  • Members
  • PipPipPip
  • Advanced Member
  • 273 posts
  • LocationUK

Posted 09 June 2006 - 08:43 PM

stick an echo inside the loop spitting like echo $atommatches[$i] . '<br />' and see what it gives you
[table]



Don't worry, the printer fairies will sort it out.

#5 vidyashankara

vidyashankara
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 09 June 2006 - 08:47 PM

[!--quoteo(post=382048:date=Jun 9 2006, 04:43 PM:name=Fyorl)--][div class=\'quotetop\']QUOTE(Fyorl @ Jun 9 2006, 04:43 PM) View Post[/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.

#6 Fyorl

Fyorl
  • Members
  • PipPipPip
  • Advanced Member
  • 273 posts
  • LocationUK

Posted 09 June 2006 - 08:52 PM

comment out lines in the loop and starting from the bottom to see which ones cause the screen to blank
[table]



Don't worry, the printer fairies will sort it out.

#7 vidyashankara

vidyashankara
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 09 June 2006 - 09:02 PM

[!--quoteo(post=382054:date=Jun 9 2006, 04:52 PM:name=Fyorl)--][div class=\'quotetop\']QUOTE(Fyorl @ Jun 9 2006, 04:52 PM) View Post[/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) View Post[/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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users