SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Location
    Los Angeles
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    making a tv schedule?

    I’m creating a TV schedule viewer and wanted to get some advise from all of you since I’m fairly new to PHP.

    I have a table in a mySQL database that looks like this:

    Code:
    TIME		DATE		NAME	
    18:00		10/20/02	SHOW1
    18:30		10/20/02	SHOW5
    05:30		10/21/02	SHOW8
    I’m creating seven day TV calendar that should look like this:
    Code:
    	MONDAY	TUESDAY	WEDNESDAY	…
    8:00	SHOW1	SHOW4	SHOW9
    8:30	SHOW3	SHOW8	SHOW5
    How do you suggest going about making this schedule with PHP? I was thinking that I would build each day with a different mySQL query (ie. SELECT name FROM schedule WHERE DATE=”10/20/02” ORDER BY time) and then run a similar query for Tuesday, etc. The only problem is that this is not resistant to the event that a show for a certain day and time is missing (ie. if Monday at 9:00 is missing then this would show that the show running Monday at 9:30 is running at 9:00 since it just orders the results).

    I assume that passing a new query for every day/time would not be very efficient (ie. SELECT name FROM schedule WHERE DATE=”10/20/02 AND TIME=”08:00”, SELECT name FROM schedule WHERE DATE=”10/20/02 AND TIME=”08:30”).

    Any suggestions on how to go about this as easily and most efficiently as possible?

    Thanks for any help you may offer!

  2. #2
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Moved to a more appropriate forum. If the thread moves into more of a PHP discussion I will move it back

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •