Jump to content

Video moves to next in line automatically at start of every day?


turtle

Recommended Posts

BASICALLY me and a mate thought itd be a kl idea to make a website, www.videoaday.co.uk - as you can see everything is functioning well except this scriptwe literally wanted to make it display just a video a day and nothing else displayed, at the start of every day 12 o'clock it moves to the next in line (I guess we will have a list of video urls prepared beforehandd)i need a genius to save me, i made it this far setting the website up but I don't know where to go next. i tried the tutorials but i'm no good with that so please don't send me that way :) :)

Link to comment
Share on other sites

The essential thing to make it work would be a cron job. This thread contains related details (from JSG) and research (from me).You'll need to:

  1. Set up a database of videos. There's no need to store timestamps with them - just a primary index, a URL, and anything else.
  2. Write a PHP form & script which adds a record to the database. Only grant access (preferably via a user database) to site staff.
  3. Write a PHP script to retrieve the current record plus anything else. require_once this script on your video page. Here's some sample SQL which you might need to modify for your table (and the newlines are unnecessary):
    SELECT * FROM videosORDER BY idLIMIT 1

  4. Write another PHP script which simply removes the current record, making the next one current.
    SELECT id FROM videosORDER BY idLIMIT 1

    Then, according to the result (the id field), delete the corresponding row.

  5. Schedule a job for each day at midnight (but in which timezone?) to run the last PHP script.

Link to comment
Share on other sites

The essential thing to make it work would be a cron job. This thread contains related details (from JSG) and research (from me).You'll need to:
  1. Set up a database of videos. There's no need to store timestamps with them - just a primary index, a URL, and anything else.
  2. Write a PHP form & script which adds a record to the database. Only grant access (preferably via a user database) to site staff.
  3. Write a PHP script to retrieve the current record plus anything else. require_once this script on your video page. Here's some sample SQL which you might need to modify for your table (and the newlines are unnecessary):
    SELECT * FROM videosORDER BY idLIMIT 1

  4. Write another PHP script which simply removes the current record, making the next one current.
    SELECT id FROM videosORDER BY idLIMIT 1

    Then, according to the result (the id field), delete the corresponding row.

  5. Schedule a job for each day at midnight (but in which timezone?) to run the last PHP script.

dude that looks amazing and all but i'm honestly not good at putting that into context. i don't even know the basics despite attempts.maybe you could help install it on the website? i'll defo create the database of videos with my friend. GMT timezone i guess we will be using (we're british) but maybe when/if it gets off the road we could have it work out what time zone you're in from your ip or something :):)
Link to comment
Share on other sites

maybe you could help install it on the website?
Sorry, that's beyond my purpose for being here; it would essentially be free contract labor. I'm here to fix this:
i'm honestly not good at putting that into context. i don't even know the basics despite attempts.
Do you have any questions to get me started? For example, what problems do you encounter while going through the local PHP tutorial (or any other, if you link to it)?
Link to comment
Share on other sites

Sorry, that's beyond my purpose for being here; it would essentially be free contract labor.
what happened to being a good sportit would only take you 10 minutes looking at how experienced you seem to be :)
Link to comment
Share on other sites

it's not a programits a script to put onto my website
yes it is
and would it really take so long ?
yes it will, well, after writing the script, setting up a test d/b, connection scripts, test data input, etc, etc...and as noted above, the purpose of the Forum here is to assist you to learn to do this for yourself.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...