Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PHP, MySQL, Cron Jobs - Scheduling timed updates on a web page

Posted on 2004-03-26
3
Medium Priority
?
1,143 Views
Last Modified: 2013-12-12
I am new to PHP, MySql and Cron Jobs. So if someone can help to guide me it will be greatly appreciated. I host several photo galleries on my website and I add one new gallery everyday. I would like to automate this process by designing a php "table of contents page" for the photo galleries that calls to a mysql database for the "new update" link, tilte and thumbnail image at the same time everyday.

This is the best way I can think of accomplishing this, please tell me if there is a better method.

I have 5 different types of galleries I would like to update each gallery once a week monday-friday. I will upload one months worth of photo galleries to the correct dirrectories then I will populate a mysql database with the thumbnail images, titles and url links that I would like to populate the php table of contents with. I will create one mysql database for each gallery type to refer to (pg1, pg2, pg3, pg4,pg5) and then one main mysql database (main) for all the images, titles, and links.

The php page for "photo gallery 1" will refer to mysql database "pg1". On php page "photo gallery1" there will be a table with 5 columns across and 4 rows down, and I will make as many pages necessry for the number of galleries. The top left cell of the table will always refer to the top or newest entry(A1) in mysql "pg1", then the next cell will refer to the next entry (B1) in the mysql "pg1", etc... etc.  The php page will never need to change.

I then want mysql "pg1" to populate once a week with the new appropriate update from mysql "main" and place that update in "A1" of mysql "pg1" and shift everything else down by one. That way the php page for "photo gallery 1"  will always have the newest update in the top left corner of the page.

So, my questions are:

Is there a better wat to accomplish my goals than the process above?

What is the correct way to have mysql "main" cron/post the new update to mysql "pg1" once a week and have everything in mysql "pg1" shift down by one?

Thank you for taking the time to read this far. I am completely new to all of this so any and all help will be greatly appreciated



0
Comment
Question by:hudel19
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Accepted Solution

by:
td234 earned 2000 total points
ID: 10706166
HI.

I have several places where I check for uploaded images and display them. Let me know if this suggestion helps. If not, tell me why and I can give you another.

Since you are uploading all your images at one and entering them into the database, let your database query do the work.

1) Add two more fields to your database; one called "publish" (type date), and another called "sort" to specify the sort order.
2) Query the images like this:
     SELECT FROM images WHERE publish < NOW() ORDER BY sort

Does this sound like it will work for you?
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question