I don't even know how to really explain this problem.
I am using a phpbb forum and I want to add some info to the phpbb_users table. I added a row called stats_points.
Here is my codeing, I know not very pretty.
<?php
// Make a MySQL Connection
mysql_connect("db location", "username", "password");
mysql_select_db("dbname");
$handle = fopen("http://fah-web.stanford.edu/teamstats/team13285.txt", "r");
$a="1";
while (!feof($handle))
{
$a++;
$buffer = fgets($handle, 4096);
if ($a >= "12")
{
$pieces = explode("\t", $buffer);
mysql_query("UPDATE phpbb_users SET stats_points = $pieces[3] WHERE username = $pieces[2]");
echo "<br>User ".$pieces[2]." has earned ".$pieces[3]." points.";
}
}
fclose($handle);
?>
The file is laid out like this:
128 1 mikejhyatt 2722586 16573 13285
276 2 GANZ 1682683 24216 13285
306 3 TheWolf 1605737 18040 13285
338 4 blc3492 1530025 5759 13285
546 5 Robpol86 1110385 11606 13285
649 6 chicorex 988710 7291 13285
916 7 jrm1900 771939 3100 13285
1215 8 Wysiwyg 630971 3361 13285
1350 9 Mad_Max3 585829 5920 13285
1356 10 Josh18657 584301 2624 13285
1464 11 RichardBrennan 552676 6792 13285
1617 12 vinster316 508839 7253 13285
1696 13 maxwedge 492951 6729 13285
1703 14 Tal 491970 7585 13285
1995 15 BarryMurphy 439750 3975 13285
2032 16 cheechi 433457 2295 13285
2095 17 Slagathor 423329 3858 13285
2846 18 abit-frodo 331137 3779 13285
There are over 600 lines
Now when I run this script I get the same data in all the fields, a 90
As far as I can tell it's getting the data from the following line, towards the bottom of the list but not at the bottom.
Now I can't figure this out, any clue would be greatly apreciated.
Thanks
Josh
edit:
thought that I would add that the echo apears correctly on the page when I run the script.
User mikejhyatt has earned 2722586 points.
User GANZ has earned 1682683 points.
User TheWolf has earned 1605737 points.
User blc3492 has earned 1530025 points.
User Robpol86 has earned 1110385 points.
User chicorex has earned 988710 points.
User jrm1900 has earned 771939 points.
User Wysiwyg has earned 630971 points.
User Mad_Max3 has earned 585829 points.
User Josh18657 has earned 584301 points.
User RichardBrennan has earned 552676 points.
User vinster316 has earned 508839 points.