Jump to content

XML, PHP - getting specific data out


silverbullet126

Recommended Posts

Hey all,

I did some searching and really didn't find anything that helped. I know somewhat how to get an xml file to show on the page, but not how to get a specific part of the data out.

Here is what i'm looking for:

--

On Now

$show_name_on_now

Coming Up

3:30pm - $show_name_30min
4:00pm - $show_name_1hr
4:30pm - $show_name_130min
5:00pm - $show_name_2hr

--

Here is the format of my XML file. I've got the time and date formated and rounding correctly, no problem there .. but searching through an XML file ... i got nothing  ???

<synweek>
<starttime>06:00:00</starttime>
<title>Good Dog</title>
<subepis>Preventing Problems</subepis>
<air_date>08/28/06</air_date>
<house>G</house>
<synopsis>Great show bah bah..</synopsis>
</synweek>

--

I need to be able to continually pick out the show title based on the current date/time of the day. The sql file holds an entire week of data... anyone have any thoughts ?  I could do this in a second if it was just an SQL database, but with XML I'm totally lost :(
Link to comment
Share on other sites

Their are two main methods to read xml sax and dom. sax reads through xml and allows you grabs it data. dom loads the xml into an object for you to access, like javascript interacting with HTML.

PHP has expat to read xml which is sax like:

http://uk2.php.net/xml

pear has a easier verson of this in:

http://pear.php.net/manual/en/package.xml.xml-parser.example.php

more detailed example:

http://www.schst.net/index.php?__path=articles.xml-parser
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.