NYCPHP Meetup

NYPHP.org

[nycphp-talk] Help!!

JeeBak Kim jbkim at cs.pdx.edu
Wed May 29 17:43:38 EDT 2002


Ahh... I added a print statement:

  print "text[$i]: " . $text[$i] . "<br>";

BEFORE the if() test in the for loop... and found that
the if() test never passes since the $text[$cur] = $id;
assignment never occurs.  The checkit() function is called as:

  while(!checkit($id = get_random_number(1, $text_ads_count))){
    ...
  }

perhaps it should be called as:

  do {
   ...
  } while(!checkit($id = get_random_number(1, $text_ads_count)));

so that the $text[$cur] = $id; assignment occurs at least once
before the checkit() call.

Hope this helps and good luck!

* jose sanchez (j_r_sanchez at yahoo.com) [020529 14:25]:
> 	
> 	function checkit( $g ){
> 		global $text, $id;
> 		
> 		for( $i = 1; $i <= 6; $i++ )
> 		{
> 		if( $text[$i] == $g )
> 		{ 
> 		print( 'ID: ' . $id . '<br>I: ' . $i . '<br>Text[' .
> $i . ']: ' . $text[$i] .
> 		 '<br>g: ' . $g );
> 		return true;
> 		}
> 		
> 		}	
> 		return false;	
> 		}
> 
> Thanks.



More information about the talk mailing list