User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 455,993 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,798 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 362 | Replies: 3
Reply
Join Date: Nov 2007
Posts: 63
Reputation: jencinas69 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
jencinas69's Avatar
jencinas69 jencinas69 is offline Offline
Junior Poster in Training

Question question

  #1  
Dec 5th, 2007
Hello I need to do a form that writes to a database I know how to do that What I dont now how to do is how I dump my data from the db as XML

I want the data to come out like this on the xml

<jobs>
<job id="5575757" title="Teacher" company="Mesa Public Schools" location="Mesa, AZ" />
<job id="8585858" title="Teacher" company="Tempe Public Schools" location="New York, NY" />

</jobs>

Any Ideas Thank you
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2007
Location: Argentina
Posts: 83
Reputation: martin5211 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 8
martin5211's Avatar
martin5211 martin5211 is offline Offline
Junior Poster in Training

Re: question

  #2  
Dec 5th, 2007
Use concatenate . and escaping \ operators like:

echo "<job id=\"". $result['id'] ."\" title=\"". $result['title'] ."\" company=\"". $result['company'] ."\" location=\"". $result['location'] ."\" />";

In this way we have the result in xml syntax.
Reply With Quote  
Join Date: Nov 2007
Posts: 63
Reputation: jencinas69 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
jencinas69's Avatar
jencinas69 jencinas69 is offline Offline
Junior Poster in Training

Re: question

  #3  
Dec 5th, 2007
Originally Posted by martin5211 View Post
Use concatenate . and escaping \ operators like:

echo "<job id=\"". $result['id'] ."\" title=\"". $result['title'] ."\" company=\"". $result['company'] ."\" location=\"". $result['location'] ."\" />";

In this way we have the result in xml syntax.



Ok but I will create a table call jobs right and the fields will be

Job_id

Title

Company

Location


Am I right?

Thank you
Reply With Quote  
Join Date: Aug 2007
Location: Argentina
Posts: 83
Reputation: martin5211 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 8
martin5211's Avatar
martin5211 martin5211 is offline Offline
Junior Poster in Training

Re: question

  #4  
Dec 5th, 2007
Yes, more difficult is to put xml data to db. Depending on your PHP version, if it is 5 you can use built-in SimpleXML functions, or in case if it is PHP4 you will need a class to parse xml to an array. Both cases will provide to you access to element attributes in a variable to put afterwards in db.
Last edited by martin5211 : Dec 5th, 2007 at 2:34 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 9:37 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC