I need to automate a couple things for my website, one of them being having the database cleared at midnight every night. I looked at cron job tutorials and came up with a script
<?php
$con = mysqli_connect("localhost", "root", "password", "test");
$sql = "DELETE FROM markers";
$con->exec($sql);
echo "Record deleted successfully";
$con = null;
INSERT INTO `markers` (`name`, `lat`, `lng`, `id`, `questTitle`, `questReward`, `category`, `date_submitted`) VALUES ('Marker1', 41.2952, -92.644, 1, NULL, NULL, NULL, NULL);
this just wipes the database and re-inserts records with empty values to be modified throughout the day.
I tried setting up a cron job to run this at midnight using cpanel, my path is
/usr/bin/php /home/user/public_html/command.php
I have the command.php in my uploaded web files and set the job to run every 30 mins to test it, but no matter what I do I cannot seem to get it to work. Any help to resolve the issue would be appreciated, thank you