Hey guys, here is my PHP code I want to run in a cron job:
I get the following error in the output being sent to my email:
I know it's running, but I don't know why it's not working? There is no update so it's not getting to the function, but the path is all correct? Does that first erro mean I should not have <?php in my cron job file?
Code:
<?php
mysql_connect ("localhost", "username", "userpass") or die ('I cannot connect to MySQL because: ' . mysql_error());
echo('Connected to MySQL<br />');
mysql_select_db ("dbname") or die('I cannot connect to the database because: ' . mysql_error());
echo('Connected to Database<br />');
mysql_query( "
UPDATE users...
" ) or die(mysql_error());
?>
Code:
/home/user/public_html/.../file.php: line 1: ?php
: No such file or directory
/home/user/public_html/.../file.php: line 2: syntax error near unexpected token `"localhost",'
/home/user/public_html/.../file.php: line 2: `mysql_connect ("localhost", "username", "userpass") or die ('I cannot connect to MySQL because: ' . mysql_error()); '
Comment