On Wed, May 23, 2012 at 2:42 PM, teji infin <[email protected]> wrote:
>  App::import('Utility', 'Xml');
>         $file =
> Xml::toArray(Xml::build('C:\wamp\www\uploadxml\app\webroot\files\new.xml'));
> //            foreach($file['NewDataSet']['Products'] as $products):
> //            {
> //                $tp['text']=$products[1];
> //                $tp['date']=$products[2];
> ////                $tp['text']=$products['gunid'];
> ////                $tp['date']=$products['stockcode'];
> //                $this->XmlTables->create($tp);
> //                $this->XmlTables->save($tp);
>
> //            }endforeach;
> //print_r($file);
>
> $this->set('teji',Xml::toArray(Xml::build('C:\wamp\www\uploadxml\app\webroot\files\new.xml')));
>        foreach($file as $val):
>             {
>                 foreach($val as $de):
>                 {
>                     foreach($de as $pt):
>                     {
>                         foreach($pt as $cd):
>                         {
>
>                             echo $cd;
> //                            $p=array('text'=>$cd[''],'date'=>$cd[1]);
> //                            $this->XmlTable->save($p);
>                         }endforeach;
>                     }endforeach;
>                 }endforeach;
>             }endforeach;
>     }
> i tried all of this bt no updation plz help.

For a start, with the foreach loops, either use the colon _or_ brackets.
foreach($array as $thing):
  do_stuff_with($thing);
endforeach;

_or_

foreach($array as $thing) {
  do_stuff_with($thing);
}

I also think you've gone too deep with the foreach loops, given the
array that you showed earlier anyway.

Where did you have that code in your app? Is it in the controller?
What is the name of the controller?

Do you get anything back to the screen when you "echo $cd;" ?

Mike.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to