I am new to using cron jobs. I am trying to run the script below on a daily basis. Go Daddy is my hosting service provider. I tried using Go Daddy's built in Cron Job Manager to create a cron job, with no success. I was wondering if someone could help me get started on creating a command that would run the following php script on a daily basis.
Is there a way to set this up by modifying the .php file alone?
I appreciate any advice.
<?php
#!/usr/bin/php
//Create mysql connect variable
$conn = mysql_connect('host', 'user', 'pass');
//kill connection if error occurs
if(!$conn){
die('Error: Unable to connect. <br/>' . mysql_error());
}
//connect to mysql database
mysql_select_db("mdb", $conn);
$results = mysql_query("SELECT * FROM files");
$name_array = Array();
while($row = mysql_fetch_array($results)){
$name_array[] = $row['name'];
}
shuffle($name_array);
for($i=0; $i < 2; $i++){
echo $name_array[$i];
}
?>