I need to run a cron but as this being my first time I have made some mistakes somewhere.
Here is my code...
Code: Select all
<?php
// connect to database
$DBusername=trek;
$DBpassword=*******;
$database=trek_sti;
mysql_connect('localhost',$DBusername,$DBpassword);
mysql_select_db($database) or die( "Unable to access database. Please try again. ERROR: Armory 0");
$sql2 = "select * from user_info" or die("Could not get user info");
$rs2 = mysql_query($sql2);
while ($row2 = mysql_fetch_array($rs2))
{
$username = $row2['username'] or die("Could not get username from array");
$attack1 = MYSQL_QUERY("SELECT * from weapons WHERE username='$username'")
or die ("An error occured while loading your data. Error: Engineering2");
$attack2 = mysql_fetch_array($attack1) or die ("An error occured while loading your data. Error: Engineering 3");
$attack = $attack2['total_attack'];
?> <P> <?php
echo "$attack";
?> <BR> <?php
echo "$username";
$strength = $attack;
$update = MYSQL_QUERY("UPDATE rank SET strength = $strength WHERE username='$username'") or die("Could not update database");
}
?>When this script attepts to run I recieve the following message...
/home/trek/public_html/scripts/update_strentgh.php: line 1: ?php
: No such file or directory
/home/trek/public_html/scripts/update_strentgh.php: line 2:
: command not found
/home/trek/public_html/scripts/update_strentgh.php: line 3: //: is a directory
/home/trek/public_html/scripts/update_strentgh.php: line 4:
: command not found
/home/trek/public_html/scripts/update_strentgh.php: line 5: =trek: command not found
/home/trek/public_html/scripts/update_strentgh.php: line 5:
: command not found
/home/trek/public_html/scripts/update_strentgh.php: line 6: =yardleys: command not found
/home/trek/public_html/scripts/update_strentgh.php: line 6:
: command not found
/home/trek/public_html/scripts/update_strentgh.php: line 7: =trek_sti: command not found
/home/trek/public_html/scripts/update_strentgh.php: line 7:
: command not found
/home/trek/public_html/scripts/update_strentgh.php: line 8:
: command not found
/home/trek/public_html/scripts/update_strentgh.php: line 9: syntax error near unexpected token `'localhost',$DBusername,$DBpassword'
/home/trek/public_html/scripts/update_strentgh.php: line 9: `mysql_connect('localhost',$DBusername,$DBpassword);
'
Any ideas? I really need this script working!! Thanks in advanced for any help you can give. Don't forget that I have not been using PHP/MySQL/Cron for very long, use beginners terms and try to explain everything