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.
On Wed, May 23, 2012 at 6:04 PM, Mike Griffin <[email protected]> wrote:
> On Wed, May 23, 2012 at 12:54 PM, teji infin <[email protected]> wrote:
> > yes sir thing is the same bt actually in my code i get an array from
> > somewhere else now that array data i have to insert it in database.
>
> And what have you tried so far?
>
> Assuming you have a Deadline model, you could try something like this
> in your controller:
>
> foreach($array['deadlines']['deadline'] as $deadline) {
> $dl['date'] = $deadline['date'];
> $dl['text'] = $deadline['text'];
>
> $this->Deadline->create($dl);
> $this->Deadline->save($dl);
> }
>
> --
> 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
>
--
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