I need to create a PHP script that runs a SQL query in a particular table. I'm then going to set up a CRON job to have the script run automatically. Is there a basic example of such a script? I found examples but they seem specific to other situations. I have the exact query that I need to run so it's the script that I need. I also want to make sure it's secure.
you don't need to do anything special because its run via a cronjob, as for secure place it outside the web root and it will accessible for the cron job but not by the outside world.
But I don't know what the code would be.
asuming mysql start here: MySQL Improved Extension or here: MySQL
Or it looks like I can just run the query right in the cron job? Something like -
mysql use databasename; -uusername -ppassword -hlocalhost -e "UPDATE tablename SET append='', prepend='' WHERE append != '' OR prepend != '';"
Is the syntax correct?
Ok I figured out the right syntax
mysql -uusername -ppassword -e "USE databasename; UPDATE table SET etc;"