Calling All PHP Pros! How Do I Do This . . .

Discussion in 'PHP' started by Masterful, Aug 23, 2008.

  1. #1
    Just as an example, imagine that on my web site I have a list of times during which a movie will be shown at different cinemas. For example:

    12:00 Odeon
    13:00 UCI
    14:00 Cineworld
    15:00 Odeon
    16:00 UCI

    Questions

    1) How can I get each listing to delete itself once it has expired?

    2) How can I make it so that the list can be sorted into New, Expiring and Most Popular (most clicked)?

    3) How can I make it so that some of the listings also show on other pages? For example, all of the Odeon listings also show on my Odeon page?

    I realise that my questions are very broad. However, I don't expect anyone to do this for me. Please just give me a basic outline, that I may learn and do it all myself.
     
    Masterful, Aug 23, 2008 IP
  2. MCJim

    MCJim Peon

    Messages:
    163
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Although I'm a beginner myself, I know that you would need to use databasing for these tasks. Look up MySQL.

    1) There might be an expiration feature on MySQL, I'm not sure. If not, you can probably use CRON on Linux or Task Scheduler on Windows. At a timed schedule, you would have a script run that checks for old times in your MySQL database and deletes them.

    2) These would be done with MySQL queries. You would have your data in a MySQL database. Sorting the data would be a matter of pulling it up through different queries. I haven't done this myself yet, so I'd appreciate if someone else gave more information on this task...

    3) You can store all the data in a MySQL database. On your other page, such as the Odeon page, you can pull up rows from the database where it is Odeon.

    Hope this helps!
     
    MCJim, Aug 23, 2008 IP
  3. Masterful

    Masterful Well-Known Member

    Messages:
    1,653
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #3
    MCJim, thanks for the help! It sounds complicated, man. :eek: I only started learning PHP yesterday, so it might take me a little while to understand this stuff and get it done.

    Does anyone else want to elaborate on MCJim's advice? Step-by-step instructions would be nice! :D
     
    Masterful, Aug 23, 2008 IP
  4. ForumJoiner

    ForumJoiner Active Member

    Messages:
    762
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    83
    #4
    What do you mean by "delete itself"? For instance, I open the page, I see the times and I leave home. Do you want that my page to display the updated values when I get back, without anyone hitting "Refresh page"? If so, you should refresh the page automatically, by reloading every x seconds, using JavaScript.
    On the other side, if you want for someone to get only the most recent values, you run a query against the current time, and display only what it's after the (currrent time +/- x minutes)

    What is New? New from someone's last visit? Or new in that week? Please define "New".
    Same for expiring.
    For the most popular question : every time someone clicks on a link, you increment a counter value for that link. The counter is stored in the database. When displaying, you sort descending the counter list and display the coresponding links.


    One PHP script works the same, no matter on what page you use. For instance, if you have a function "Display_Odeon ()" you can use on any page you want. All calls to that function will display the same information, because they use the same database.
     
    ForumJoiner, Aug 23, 2008 IP
  5. cornetofreak

    cornetofreak Peon

    Messages:
    170
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i would just do an if else statments to check date and times and if its a dead film run a delete SQL string
     
    cornetofreak, Aug 24, 2008 IP