For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > March 2005 > Command Line Error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Command Line Error
Ron Piggott

2005-03-28, 3:56 pm

I wrote a really simple 11 or 12 line PHP script to remove old entries from
a web card application I made:

<?

$todays_date=DATE("Y-m-d");

$username="user";
$password="password";
$database="database";

mysql_connect(localhost,$username,$passw
ord);
@mysql_select_db($database) or die( "Unable to select database");

$query = "DELETE FROM `webcardtable` WHERE `date_to_be_deleted` LIKE
'$todays_date'";
mysql_query($query);
mysql_close();
?>

When this is run from the web it works fine.

I wanted it on a CRON ---- then the expired entries are removed
automatically.

Take a look at this line:

$todays_date=DATE("Y-m-d");

When it is ran from the command line this line causes the script to give
these error messages:

/home/actsmin/actsministries-www/webcards/administration/daily_maintenance.p
hp3: line 3: syntax error near unexpected token `DATE("'
/home/actsmin/actsministries-www/webcards/administration/daily_maintenance.p
hp3: line 3: `$todays_date = DATE("Y-m-d");'

Any idea why the command line can't deal with but the http:// version works
just fine?

Ron
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com