0

I've been racking my brains for this all afternoon. Ive search various forums and web sites and nothing seems to be working right.

This is the SQL query that i got help with earlier from a member on Stackoverflow and works perfectly in phpmyadmin SQL query window

UPDATE members SET  `status` = IF( (
SELECT monday_ashore
FROM system
WHERE id =  '1'
) =  'Yes',  'ASHORE',  `status` );

and this is the code that i have in the php script:

//Monday Force All Ashore Cron Page <?php
include ("../config/db_connect.php");
$sql = ("UPDATE members SET  `status` = IF( (
SELECT monday_ashore
FROM system
WHERE id =  '1'
) =  'Yes',  'ASHORE',  `status` ");
?>

This script is set to be a CRON script. how do i get it to run by navigating to it through web site for testing and for it to actually work. What am i doing wrong or missing, any help would be greatly appreciated.

Dharman
  • 30,962
  • 25
  • 85
  • 135

1 Answers1

-1

From what I can see it's in your 'include' statement. Since you are referencing it dynmaically with a '../' there is no guarantee cron will accept that (cron assumes you are starting from your home directory). change that to a fully qualified directory name and that should solve your problem, as mentioned above fix your missing ')'

Forbs
  • 1,256
  • 1
  • 7
  • 9
  • Tried doing what you have suggested, and it does not execute in the .php page. I changes the include line to the full web address and directory name, but still not executing the sql query. – Mark Rhodes Mar 22 '17 at 19:12
  • You can't use a 'full web line'. It would be something like */var/html/www/myproject/config/db_connect.php* which is a fully qualified file. Do you have shell access? did you try php MYPROJECT.php and see what it returns? – Forbs Mar 22 '17 at 19:17