Friday, August 31, 2012

for statement

Hi ppl...
I'm a beginner in programming, and I know what i ask my seem too simple, I just need it too much and soon :)

there is a problem in in statement.

$this->set('position', 0);

if(in_array($_GET['var'], $this->Word->findById(11)))
{
$this->set('position', $this->array_search($_GET['var'],$this->Word->findById(11)));

} 

or as the same: 

$position = 0;
$var_get = $_GET['var'];
$word = $this->Word->findById(11);

if(in_array($var_get, $word ))
{
$position = $this->array_search($var_get,$word);
}
$this->set('position', $position );



when i write

echo $position in view.ctp, it echoes always 0.

Thanks.

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

No comments: