Retrieve data from database file using id, output, serve up XML to html pages

Posted on 2011-10-10
Medium Priority
Last Modified: 2012-05-12
Hi everyone,

I have 3 html pages and I would like specific content on each page to be dynamic. I would like the header text, featured image, and body text to be served up dynamically from a SQL database or Excel file.

The idea is to serve up specific headlines with corresponding images using their IDs pulled from the database/table file.

id 1 Whatever headline a    
id 2 Whatever headline b
id 3 Whatever headline c

and match it up with the featured images and body content:

id img1 Image of a cow
id img2 Image of a horse
id img3 Image of a goat

id body1 lorem ipsum blah blah content block
id body2 lorem ipsum blah blah block of text
id body3 lorem ipsum block of content

I would like to serve this data up via an xml file but I'm not sure how to do it and I need it done fast.

In basic terms, XML file should go something like this:

If display id 1 Whatever headline a
then display id img2 image of a horse
and id body3 lorem ipsum block of content

And serve up the matching content to the html pages with an XML string or something.

Will the code be simple to understand and implement? If possible, please give an example that I can test on my server in order to understand how to do it.

I don't know. Obviously I need help, I'm not a programmer. I need to understand how to do this but it needs to be done asap so this is a call for help. Your input is very appreciated!

Thank you!
Question by:imawake
  • 4
  • 3

Author Comment

ID: 36949477
Can anybody offer any ideas?

Thank you!

Author Comment

ID: 36949561
Alternatively, this data could be in the XML file and served client-side to the html pages with javascript or something. Please let me know if you can offer help in one or both methods.


Expert Comment

ID: 36950356
Hi iamawake, Well, since no one is daring, I will take the risk...  but I cannot provide you an "answer"...

Just so you know, the reason I did not speak up to begin with is this seems to me like either you are taking a test and want the answer, or you do not know how to conduct the most fundamental search on the internet for something very basic - and yet you want information about how to do something that is going to take you some bit of time (something you say you do not even have) to actually learn about before you can begin to tackle the problem on your own...
-- which is way beyond the scope of something like posting a question in a forum like EE,
....and personally, I do not want to become burdened portending to offer help under these conditions.

I do not mean to posture condescendingly.  I am just calling it how I see it.

That said, since you are persisting, here is what I would say to your question...

1) The very first thing anyone is going to ask is why do you want to use xml?  
The problem with even asking is you have made it clear you do not have a clue about the scope of the problem you wish to address, so I don't really want to bother answering...

2) So this brings us to asking you... have you even tried to search the internet at all??
The problem with that question is I don't think we'd see a question posed in this way if you had, so again, don't bother answering that one either....

But hey, I could be wrong...

All right, I will quit busting your nuts now and offer this...

#1 In your favorite internet search engine conduct the following searches...

simple mysql php

sql php xml

simple mysql php xml

simple html xml

On the first search I found what appears to be a great tutorial to get you started understanding the nuts and bolts of how you could create and use a simple mysql database and use php to accomplish  everything you want.  It appears like a great beginning.

...I only glanced at it so I cannot ultimately vouch.. you are going to have to do some reading up with other results that catch your eye.  

If you want to do xml you will find there some great tools out there for putting together a package, and some great guides.  
I found this intersting...  http://www.ibm.com/developerworks/library/x-query2xml/
Probably not what you are looking for however.

The bottomline is, no one can simply tell you "how to" do it from scratch without you have time to take steps in learning about these tools.  However, you say you do not have time (to learn).

Either you gotta learn it, or you are going to have to hire someone to simply do it for you.

Good luck on your journey.

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!


Author Comment

ID: 36950457
Thanks for the reply. I understand that what I'm asking is quite in depth and I don't mean to be asking for a perfect answer or for you to do it for me. I did look up several options specifically about client-side xml and javascript and I have knowledge of using xml with flash, but this is the first time I've attempted something like this. I'll see what I can come up with in the meantime and if I can figure out a simpe solution using javascript, xml and an access db, I should be fine.

If anyone would like to offer further input, it would be appreciated.

Accepted Solution

twohawks earned 2000 total points
ID: 36951577
Okay then. This helps.

My recommendation....

First, glean an overview of what is entailed working with a database for webdev.  
In the first link above there is really good primer for understanding and getting started with the mysql database, which I think you could easily be using.  The same principles apply for working with any database, so its worth going over mysql-related tuts early on (since they are so commonly written up) , and then I am sure you could sort out the access db nuances afterward, if that's what you prefer to chase down.

Since you have some familiarity with javascript asnd xml, perhaps an Ajax / XML option would feel right?

Here are some links to some decent tuts along these lines....





Overview gleaned thru these pages I think have good potential for eliciting an "aha!".
Just my two-sense.

It is typically not in alignment with EE policy to post links for answers to questions.
Considering the depth of your inquiry, however, I think an exception may be in order, so I have taken liberty to post  these links for you (in my responses) in hope it can help you quickly suss out what pathway may appear to be a suitable route for chasing down your own solution.

Honestly, go talk a light walk thru those.  Don't get bogged down in the details.  Skim thru for a general overview and see if anything sticks.

Hope this is helpful to you.

Author Comment

ID: 36951628
Ok, thank you. This does help.

Expert Comment

ID: 36952059
You are most welcome, iamawake.

I am surprised you closed the question so soon.  Perhaps some others may have chimed in over the course of a couple days.

Anyway, thank you for the points assignment.  I hope you sort out a viable solution without too much trouble.

There is another option that I did not mention... Content Management System Software, or using a "CMS".
A CMS software package is like a custom development kit for dynamic site building.  
Some examples are the popular wordpress, drupal, joomla, etc...

There are CMS packages taylored for just about any coding focus you can think of.
For instance, there are xml-based cms for developers (see links below ;^)

If you are unfamiliar with CMS systems, throw your searchbar at that for a spell.

Lastly, Here are a couple other tidbits for your journey ;^)
Build an XML-Based Content Management System with PHP (2003 - old but still handy ;^)

The related discussion thread to that article

*A list of XML based CMS for Web Developers   ;^)
http://www.tutorialfeed.org/2009/08/list-of-xml-based-cms-for-web.html    (2009)
http://gurushala.net/xml-based-cms-for-web-developers/      (2010)

Good Luck!

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
Over time, the online landscape has altered considerably, but that’s nothing compared to the up-and-coming trends that will shape the web design industry in the coming year. Keep reading to find out which trends will shape B2B web design in 2018.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question