I'm a numpty, completely and utterly. I fudge my way through php / mysql learning commands as necessary to tweak existing scripts. What I'm not good at is actually writing programs from scratch / designing programs from scratch. I thought I'd query here as its a much more interested market.
Something I've been pondering for quite a few months now is an automated way of producing the same (or 99%) of the stats that go into the weekly F@H stats.
In theory this should be simple.
Every couple of hours or so my server grabs
http://vspx27.stanford.edu/teamstats/team10.txt
then clears the db:
and then explodes the text file (stored as $fp)
If there is anyone with good php / mysql skills around and fancies having a stab, I'm confident this should be easy to achieve, and just as easy to make the output bbcode friendly too
Something I've been pondering for quite a few months now is an automated way of producing the same (or 99%) of the stats that go into the weekly F@H stats.
In theory this should be simple.
Every couple of hours or so my server grabs
http://vspx27.stanford.edu/teamstats/team10.txt
then clears the db:
Code:
$sql = 'DELETE FROM `fah`';
$result = mysql_query($sql);
$sql = 'DELETE FROM `teamrank`';
$result = mysql_query($sql);
and then explodes the text file (stored as $fp)
Code:
/* Take the rank and insert it into a seperate table in the DB */
$teampos = $fp[6];
$pieces = explode (" ",$teampos);
$query = "INSERT INTO `teamrank` (`rank`) VALUES ('".$pieces[2]."')";
$result = mysql_query($query);
/* Grab all the user data from the source and put it into a table */
$number_of_lines = count($fp);
for ($i=10; $i<$number_of_lines; $i++)
{
//split up each line
$line = explode( "\t", $fp[$i]);
$query = "INSERT INTO `fah` (`rank`, `teamrank`, `name`, `credit`, `total`, `workunits`) VALUES ('".$line$
$result = mysql_query($query);
}
?>
If there is anyone with good php / mysql skills around and fancies having a stab, I'm confident this should be easy to achieve, and just as easy to make the output bbcode friendly too