0

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

2
Contributors
3
Replies
5
Views
9 Years
Discussion Span
Last Post by martin5211
0

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.

0

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

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.