XML insertion

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tvks
Forum Newbie
Posts: 3
Joined: Wed Nov 22, 2006 4:34 am

XML insertion

Post by tvks »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,

I have many XML files with the following structure.

[syntax="xml"]
<employees>

  <employee>
     <name>Rajiv</name>
     <telephone>1234</telephone>
  </employee>

  <employee>
     <name>Waltai</name>
     <telephone>2113</telephone>
  </employee>

</employees>
I need to develop a function in php where I pass the following parameters:

filename (XML file name abc.xml)
rajiv (record to be changed <name>)
mail (field name to be inserted <mail>)
rajiv@plus2net.com (value to be inserted)

Say, I am naming the function as[/syntax]

Code: Select all

insert("abc.xml","rajiv","mail","rajiv@plus2net.com")
When I execute this function the details of employee rajiv in above xml file should change as

Code: Select all

  <employee>
     <name>Rajiv</name>
     <telephone>1234</telephone>
     <mail>rajiv@plus2net.com</mail>
  </employee>
Kindly help me urgently.

With regards


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Do you have one of the XML libraries installed into PHP? What have you tried so far?
Post Reply