Jump to content


XML, PHP - getting specific data out

  • Please log in to reply
2 replies to this topic

#1 silverbullet126

  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 31 August 2006 - 03:22 PM

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


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

<title>Good Dog</title>
<subepis>Preventing Problems</subepis>
<synopsis>Great show bah bah..</synopsis>


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 :(

#2 pmeasham

  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 31 August 2006 - 04:15 PM

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:


pear has a easier verson of this in:


more detailed example:


Peter Measham
Unique IQ Ltd

#3 Barand

  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 31 August 2006 - 08:28 PM

If you have php5, look at simpleXML
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received


|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users