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

Posted on 2011-10-10
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

    Author Comment

    Can anybody offer any ideas?

    Thank you!

    Author Comment

    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.

    LVL 8

    Expert Comment

    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...
    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.


    Author Comment

    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.
    LVL 8

    Accepted Solution

    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

    Ok, thank you. This does help.
    LVL 8

    Expert Comment

    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   ;^)    (2009)      (2010)

    Good Luck!

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    This article describes some very basic things about SQL Server filegroups.
    SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
    This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
    The viewer will learn how to dynamically set the form action using jQuery.

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now