Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8078933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:56:59+00:00 2026-06-05T15:56:59+00:00

Can someone please provide an example of how to store, and read xml data

  • 0

Can someone please provide an example of how to store, and read xml data into MySQL?
I’m using php, and I’ve read this documentation: http://dev.mysql.com/doc/refman/5.6/en/xml-functions.html

But I simply cannot get results that I want.

Thank you very much. (I’m using this because I have a lot of calls to the data stored in the xml, and I need faster functions.)

[EDIT]
As per request:

I currently have 30k .xml files with anywhere from 25-50 elements in each file.
I ask for values in various files hundreds of times a second.
I’m finding there’s a huge bottleneck from the I/O actions preformed here.

I think storing the data from the .xml files into a database would make accessing the values
a much faster process.

I’m asking for help/advice on how to go about this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:57:01+00:00Added an answer on June 5, 2026 at 3:57 pm

    Accessing the data stored in the database will be no faster than accessing them on the disk. The database speed is provided by being able to index the data, and the contents of the XML is (I assume) not indexed.

    So unless you can take key fields out of the XML it is not going to help you.

    However, in answer to your actual question (rather than whether it is a good idea), if you are using a mysqli connection and a prepared statement:

    if ($stmt = $mysqli->prepare("INSERT INTO MY_DATA_TABLE (Id, Data) VALUES(?,?)")) 
    {   
        $stmt->bind_param('ib', $id, $data);
        for($i = 0; $i < $numfiles; $i++)
        {
            $id= $row;
            $data=  readfile($id);
            $stmt->execute();
        }
     }
    

    Something like that? (Haven’t tried it).

    EDIT:

    But from your answer, if you just want to read the elements from the XML files, you probably need to look at simple XML: http://php.net/manual/en/book.simplexml.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please provide an example of using set_bound() method from Test::MockObject module? Can
Can someone please provide a multipart/form-data POST example based on: How can I unit
Can someone please provide an example of how to read and print sydney and
I've been stuck for 2 days on this. Can someone please provide an example
Can someone please provide a simple example of how to consume a REST service
Can someone please provide an example on how to use plural forms in a
Can someone please provide some example code on how I could create the following
can someone please provide an example of how to use uBLAS product to multiply
I can't make sense of any of the documentation. Can someone please provide an
Can someone please provide an example of creating a Java ArrayList and HashMap on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.