sry, what you are doing there is just horrible. I cannot find any other
words for it.
please go through tutorials and the book first
your code is a mess in multiple ways
and it doesnt seem you have understood a single bit of what i wrote. you
cannot just use those deep arrays in php functions.
no way! and if you properly debug you would notice.
also - besides all that - why retrieving the db data twice or more? using
find(all) 2x? /:)
Am Sonntag, 2. September 2012 08:04:48 UTC+2 schrieb girl:
>
> Thanks people.
>
> I debug, it returns null :/
> Means something is wrong in code.
>
> Here is my controller:
>
> <?php
> class IndexsController extends AppController {
> public $helpers = array('Html', 'Form', 'Session');
> public $components = array('Session');
>
> public function index() {
>
>
> // loading Game model
> $this->loadModel('Game');
> $game = $this->Game->find('all');
> $this->set('games', $this->Game->find('all'));
> // loading Word model
> $this->loadModel('Word');
> $word = $this->Word->find('all');
> $this->set('words', $this->Word->find('all'));
> }
> public function view($id) {
> // loading Game model
> $this->loadModel('Game');
> $game = $this->Game->find('all');
> $this->set('games', $this->Game->find('all'));
> $dif=$game['Game']['difficulty'];
> // loading Word model
> $this->loadModel('Word');
> $word = $this->Word->find('all');
> $this->set('words', $this->Word->find('all'));
> $this->Game->id = $id;
> $this->set('game', $this->Game->read());
> //variables
> $this->set('rand', rand(1,$this->Word->find('count')));
> $this->set('randword', $this->Word->findById(11));
> //$this->set('word_array', str_split(implode("",
> $this->Word->findById(11)),1));
> $this->set('word_array', str_split('fight',1));
> $this->set('code', array("*", "*", "*", "*", "*"));
> $code=array("*", "*", "*", "*", "*");
> for ($i =97; $i<=122; $i++) {
> $letter .= "<a
> href='view.ctp?code=".$code."&var=".chr($i)."&dif=".$dif."'>".chr($i)
> ."</a>". " ";
> $this->set('tar', $letter);
>
>
>
>
> $this->set('popoxakan', $_GET['var']);
>
>
> $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 );
>
> }
>
> }
> }
> ?>
>
>
> And here view
>
> <?php
> echo "word= " .$randword['Word']['word']."</br>";
> echo $tar."</br>";
> echo $popoxakan."</br>";
> echo "position= ".$position."</br>";
> ?>
>
--
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.