what i would do if i was you is the following:
$query="SELECT id FROM $TBL_Mem WHERE paid=1";
$result=@mysql_query($query); ///// Run the query
$num=mysql_num_rows($result); ///// How many users have paid
echo "Num : $num<br>";
$i = 0;
for ($row=mysql_fetch_array($result)) {
$i++;
echo "Counter : $i<br>";
if (isset($row)) {
$queryA="SELECT $TBL_Mem.id,
$TBL_Picks.ef1,
$TBL_Picks.ef2,
$TBL_Picks.ef3,
$TBL_Picks.ed1,
$TBL_Picks.ed2,
$TBL_Picks.eg,
$TBL_Picks.wf1,
$TBL_Picks.wf2,
$TBL_Picks.wf3,
$TBL_Picks.wd1,
$TBL_Picks.wd2,
$TBL_Picks.wg
FROM $TBL_Mem,
$TBL_Picks
WHERE
$TBL_Mem.paid=1
AND $TBL_Mem.id=$TBL_Picks.id"; ///// Selects the picks according to paid members
instead of
$query="SELECT id FROM $TBL_Mem WHERE paid=1";
$result=@mysql_query($query); ///// Run the query
$num=mysql_num_rows($result); ///// How many users have paid
echo "Num : $num<br>";
for ($i=1;$i<=$num;$i++) {
echo "Counter : $i<br>";
$row=mysql_fetch_array($result, MYSQL_NUM);
if (isset($row)) {
$queryA="SELECT $TBL_Mem.id, $TBL_Picks.ef1, $TBL_Picks.ef2, $TBL_Picks.ef3, $TBL_Picks.ed1, $TBL_Picks.ed2, $TBL_Picks.eg, ";
$queryA.="$TBL_Picks.wf1, $TBL_Picks.wf2, $TBL_Picks.wf3, $TBL_Picks.wd1, $TBL_Picks.wd2, $TBL_Picks.wg ";
$queryA.="FROM $TBL_Mem, $TBL_Picks WHERE $TBL_Mem.paid=1 AND $TBL_Mem.id=$TBL_Picks.id"; ///// Selects the picks according to paid members
this makes the code more readable in my opinion.
you are also still uing $i twice (italic and bold marked)
for ([b]$i[/b]=1;[b]$i[/b]<=$num;[b]$i[/b]++) {
echo "Counter : [b]$i[/b]<br>";
$row=mysql_fetch_array($result, MYSQL_NUM);
if (isset($row)) {
$queryA="SELECT $TBL_Mem.id, $TBL_Picks.ef1, $TBL_Picks.ef2, $TBL_Picks.ef3, $TBL_Picks.ed1, $TBL_Picks.ed2, $TBL_Picks.eg, ";
$queryA.="$TBL_Picks.wf1, $TBL_Picks.wf2, $TBL_Picks.wf3, $TBL_Picks.wd1, $TBL_Picks.wd2, $TBL_Picks.wg ";
$queryA.="FROM $TBL_Mem, $TBL_Picks WHERE $TBL_Mem.paid=1 AND $TBL_Mem.id=$TBL_Picks.id"; ///// Selects the picks according to paid members
$resultA=@mysql_query($queryA); ///// Run the query
$rowA=mysql_fetch_array($resultA, MYSQL_NUM); ///// Return a record if exists
$user=$rowA[0];
for ([i]$i[/i]=1;[i]$i[/i]<=count($rowA)-1;[i]$i[/i]++) {
$queryB="SELECT CONCAT((goal*$PTS_Goal)+(assist*$PTS_Assist)+(otgo
al*$PTS_OTGoal)+(shutout*$PTS_ShutOut)+(otwin*$PTS
_OTWin)+(otloss*$PTS_OTLoss)) AS points ";
$queryB.="FROM $TBL_Pla WHERE $TBL_Pla.id=$rowA[[i]$i[/i]]";
$resultB=@mysql_query($queryB); ///// Run the query
$rowB=mysql_fetch_array($resultB, MYSQL_NUM); ///// Return a record if exists
$points+=$rowB[0];
}
$Pool_Pos[$user]=$points;
}
}
the inner $i (italic) resets the one in the outer loop (bold)!
=> dammit... it wont accept vBcode in PHP code... so - look out for the [ b]$i[ /b] and the [ i]$i[ /i]
furthermore:
- take out the "@" to suppress errors until the code does what you want. you want php to point you to possible errors when testing!