Jump to content

Displaying Xml Content


hallytom

Recommended Posts

Hi,

 

Firstly as a disclaimer, I am not requesting any code to be supplied, this is to be used in a University project and I am aware of the relevant regulations and would like to create the code myself, I am only trying to get help pointing me in the right direction.

 

I am using PHP to display the contents of a MySQL database, as part of the product I would like to display the database in a format similar to a directory browser.

 

I am reading in from an XML file of the database which is created using MySQL dump, I would then like to be able to iterate through this and display the Databases and tables in a list almost, but one that is dynamic and possibly interactive to the point of being able to select tables and fields to be able to view in more detail in another part of the program.

 

Is this possible to achieve using PHP or any other languages that can be incorporated into this program.

 

As an example, below is how I would like to display the contents to the user, with the + and - representing the default standard or showing more or less sub content.

 

+ROOT

-MySQL

-Schema

-Table 1

-File 1

+Table 2

+User Table 1

 

Thanks in advance for any help.

 

Regards,

 

Tom

Link to comment
Share on other sites

Yes, this is quite possible. All you need is to read the XML file with the SimpleXML class, then loop through the schema's tables. Since the number of fields is variable as well, you'll need a secondary inner loop for them, but that's pretty much it.

 

PS: This should probably have been posted in the "Application design" section, seeing as you're not actually looking for help with your PHP code. ;)

Link to comment
Share on other sites

Yes, this is quite possible. All you need is to read the XML file with the SimpleXML class, then loop through the schema's tables. Since the number of fields is variable as well, you'll need a secondary inner loop for them, but that's pretty much it.

 

Thanks for the assistance, how about displaying the data would this just be down to formatting in html?

 

Regards,

 

Tom

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.