Reply to Re: Scripting Advice

Your name:

Reply:


Posted by trawets on 11/09/07 20:28

On 8 Nov, 22:01, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> trawets wrote:
> > Hi
> > I am trying to write something which will enable me to run a php
> > script from cron which will delete news item entries from a mysql db.
>
> > Criteria here is that the script would look at a field 'publish_down'
> > which has this format '2007-01-29 16:00:08' check this date is passed
> > and then delete if it is more than 90 days older.
>
> > I have tried to come up with something but a little advise would be
> > grateful
>
> > $today = date("Y-m-d", publish_down("-90 days"));
>
> > mysql_query("DELETE FROM table WHERE date = '$today'") or
> > die(mysql_error());
>
> > (publish_down = a table field which is a date)
>
> > how would I adopt this type of query into php script
>
> > please
> > trawets
>
> I'm not sure what you mean when you say "adopt this type of query into
> php script". It should work pretty much like you have it.
>
> Although personally I would not have a column named date (reserved
> word), would not call the variable $today (it's not - it's 90 days ago
> and could be confusing), and I would check for date <= '$today', just in
> case the script doesn't get run one day.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================- Hide quoted text -
>
> - Show quoted text -

Hi
Thanks for the reply I have taken on board what you mean about some of
the labels used and will address this

What I meant (I think) was this would require incorporating in a full
stand alone script which would log into the db and do the required
look and delete maybe on a daily basis

I am sorry if it all sound a bit weird, as I am a novice a this with
just some basic skills in this area
Again thanks for the reply a least now I know it might work
trawets

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация