By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,215 Members | 1,005 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,215 IT Pros & Developers. It's quick & easy.

Working with PHP, XML, MySQL

P: n/a
Hello,
I am having an XML file that contains booking details. These booking
details are supposed to get gennerated from a booking application.
I then need to build a system that will process those XML files and
store them inside a MySQL DB using PHP.
Is there any standard methodology to do such thing ?

IS there a class I should use to make my life easier?
The ideal situation would be to somehow achieve storing the XML
elements inside a multidimensional array and then insert them in the
DB...

Can you point me in the right direction please ? I 've never dealt
with XML parsing.

Thanks in advance.

Mar 2 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 2007-03-02 10:43:55 +0000, "Aggelos" <dj*****@gmail.comsaid:
Hello,
I am having an XML file that contains booking details. These booking
details are supposed to get gennerated from a booking application.
I then need to build a system that will process those XML files and
store them inside a MySQL DB using PHP.
Is there any standard methodology to do such thing ?

IS there a class I should use to make my life easier?
The ideal situation would be to somehow achieve storing the XML
elements inside a multidimensional array and then insert them in the
DB...

Can you point me in the right direction please ? I 've never dealt
with XML parsing.

http://www.php.net/xml

http://www.php.net/SimpleXML

Hope this helps

Andrew

Mar 2 '07 #2

P: n/a
On Mar 2, 1:40 pm, Andrew Taylor wrote:
On 2007-03-02 10:43:55 +0000, "Aggelos" <djje...@gmail.comsaid:
Hello,
I am having an XML file that contains booking details. These booking
details are supposed to get gennerated from a booking application.
I then need to build a system that will process those XML files and
store them inside a MySQL DB using PHP.
Is there any standard methodology to do such thing ?
IS there a class I should use to make my life easier?
The ideal situation would be to somehow achieve storing the XML
elements inside a multidimensional array and then insert them in the
DB...
Can you point me in the right direction please ? I 've never dealt
with XML parsing.

http://www.php.net/xml

http://www.php.net/SimpleXML

Hope this helps

Andrew
That requires PHP5 :S is there something for PHP4 ?

Mar 2 '07 #3

P: n/a
NC
On Mar 2, 2:43 am, "Aggelos" <djje...@gmail.comwrote:
>
I am having an XML file that contains booking details. These booking
details are supposed to get gennerated from a booking application.
I then need to build a system that will process those XML files and
store them inside a MySQL DB using PHP.
Is there any standard methodology to do such thing ?
No. There are many PHP extensions that can be used to parse XML.
Since you mentioned later in the thread that you are using PHP 4,
here are two extensions that work with PHP 4:

http://www.php.net/XML
http://www.php.net/DOMXML

Cheers,
NC

Mar 2 '07 #4

P: n/a
On Mar 2, 3:22 pm, "NC" <n...@iname.comwrote:
On Mar 2, 2:43 am, "Aggelos" <djje...@gmail.comwrote:
I am having an XML file that contains booking details. These booking
details are supposed to get gennerated from a booking application.
I then need to build a system that will process those XML files and
store them inside a MySQL DB using PHP.
Is there any standard methodology to do such thing ?

No. There are many PHP extensions that can be used to parse XML.
Since you mentioned later in the thread that you are using PHP 4,
here are two extensions that work with PHP 4:

http://www.php.net/XMLhttp://www.php.net/DOMXML

Cheers,
NC
I've used miniXML which works quite well, but I am getting some weird
NOTICES
Notice: Only variable references should be returned by reference in /
PATH/TO/DIR/miniXml/classes/element.inc.php on line 610

:s
but i still have some problems as the XML structure has multiple
elements with the same name but different attributes

e.g.
+ <Supplier>
+ <Originator>
+ <PassengerDetail p="1">
+ <PassengerDetail p="2">
+ <PassengerDetail p="3">

and I don't know how to put these an array

array[PassengerDetail][1]
array[PassengerDetail][2]
array[PassengerDetail][3]

thank you.

Mar 2 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.