geolaw
geolaw

Reputation: 452

Which should I use? SQL Triggers or Cron Jobs?

I am working on a scheduling system that allows for content managers to add content that will go live at a later set date. My SQL/PHP knowledge is not the greatest and after some extensive research I am finding it difficult to figure the best option to use when building this system. Should I use Cron Jobs? or SQL Triggers?

I am looking to make it so I can also execute some PHP along with the SQL commands that will set the content to live.

Upvotes: 1

Views: 849

Answers (2)

geolaw
geolaw

Reputation: 452

Thanks for all of the responses, all of it has been super useful in helping me come to a conclusion. I will be using Cron Jobs to get this specific job done.

Upvotes: 0

Hans Kilian
Hans Kilian

Reputation: 25622

I would use neither. I'd have a 'goLive' datetime and a 'retire' datetime for each piece of content. Then when you select which content to show, you'd have a where clause like this

where current timestamp between goLive and retire

Then your content appears at the 'goLive' time and disappears at the 'retire' time.

Upvotes: 3

Related Questions