Page 1 of 1

Parse error: parse error, expecting `T_WHILE'

Posted: Fri Aug 31, 2012 2:38 am
by gaugererik
I get this error on php page

my code is

Code: Select all

function main( )
{
    include( "../connection.php" );
    include( "logincheck.php" );
    $memid = $_SESSION['memid'];
    $select_user = mysql_fetch_array( mysql_query( "select * from users where UserID='{$memid}'" ) );
    $select_ref = mysql_fetch_array( mysql_query( "select * from admin" ) );
    $referal_list_num = mysql_num_rows( mysql_query( "select distinct referred_id from referral_list" )
	}
	
	 );
    echo "\r\n<form name=\"frm1\" method=\"post\" action=\"approve_active_to_inactive_code.php\" onSubmit=\"return ValidateForm(frm1)\">  <TABLE id=content height=0 cellSpacing=1 cellPadding=1 width=\"100%\" \r\n            border=0>\r\n    <TBODY>\r\n      <TR>\r\n        <TD vAlign=center colSpan=4 height=54><TABLE cellSpacing=0 cellPadding=0 width=\"100%\" border=0>\r\n          <TBODY>\r\n            <TR>\r\n              <TD>&nbsp;</TD>\r\n ";
    echo "             <TD class=headertext>&nbsp;</TD>\r\n            </TR>\r\n            <TR>\r\n              <TD width=\"3%\"><IMG height=16 \r\n                        src=\"images/icon7.gif\" \r\n                        width=19></TD>\r\n              <TD class=headertext width=\"97%\">AFFILIATE MEMBERS LIST </TD>\r\n            </TR>\r\n          </TBODY>\r\n        </TABLE>\r\n            <BR>\r\n            <TABLE cellSpacing=0 cellPaddin";
    echo "g=0 width=\"98%\" align=center \r\n                  border=0>\r\n              <TBODY>\r\n                <TR>\r\n                  <TD><DIV class=smalltextgrey align=center>\r\n                      <DIV class=smalltextred align=left>Below is the list of \r\n                        all Affiliates....</DIV>\r\n                  </DIV></TD>\r\n                </TR>\r\n              </TBODY>\r\n            </TABLE>\r\n          <BR>\r";
    echo "\n            <TABLE cellSpacing=1 cellPadding=1 width=\"54%\" align=center \r\n                  border=0>\r\n              <TBODY>\r\n                <TR>\r\n                  <TD><DIV class=BlueBoxheader \r\n                    align=center>";
    echo "<s";
    echo "pan class=\"ntleft\">\r\n                    ";
    if ( $_REQUEST['send'] == "added" )
    {
        echo "<span class='messages'>Your Have Successfully Made Payment To : {$select_user['LoginID']} </span>";
    }
    echo "                                      </span>";
    echo "<s";
    echo "pan class=\"ntleft\">\r\n                                       ";
    if ( $_REQUEST['send'] == "make" )
    {
        echo "<span class='messages'>Please Select Member(s) to make Affiliate Payment </span>";
    }
    echo "                                      </span></DIV></TD>\r\n                </TR>\r\n              </TBODY>\r\n            </TABLE>\r\n          <BR></TD>\r\n      </TR>\r\n      <TR>\r\n        <TD class=HeadText1 vAlign=top colSpan=4><TABLE cellSpacing=3 cellPadding=3 width=\"98%\" align=center \r\n                  border=0>\r\n          <TBODY>\r\n            <TR>\r\n              <TD>";
    echo "<S";
    echo "PAN class=Partext1>";
    echo "<s";
    echo "pan class=\"ntleft\">(";
    echo $num;
    echo ")</span> Profiles Found</SPAN></TD>\r\n              <TD><DIV align=right>";
    echo "<S";
    echo "PAN class=Partext1>Page 1 of 1 </SPAN></DIV></TD>\r\n            </TR>\r\n          </TBODY>\r\n        </TABLE>\r\n            <TABLE cellSpacing=2 cellPadding=2 width=\"98%\" align=center \r\n                  border=0>\r\n              <TBODY>\r\n                <TR>\r\n                  <TD></TD>\r\n                </TR>\r\n              </TBODY>\r\n            </TABLE>\r\n          <TABLE class=blackbox cellSpacing=0 cellPadding=4 w";
    echo "idth=\"98%\" \r\n                  align=center border=0>\r\n              <TBODY>\r\n                <TR>\r\n                  <TD class=HeadText1 width=\"5%\" bgColor=#ececec>&nbsp;</TD>\r\n                  <TD class=paratext width=\"20%\" bgColor=#ececec>Username</TD>\r\n                  <TD class=paratext width=\"12%\" bgColor=#ececec>Reg On</TD>\r\n                  <TD class=paratext width=\"14%\" bgColor=#ececec>";
    echo "<s";
    echo "pan class=\"topmenu\" style=\"padding-right:0px; padding-left:4px\">No Of Reffers</span></TD>\r\n                  <TD class=paratext width=\"16%\" bgColor=#ececec>Paid Amount </TD>\r\n                  <TD class=paratext width=\"15%\" bgColor=#ececec>Balance</TD>\r\n                  <TD class=paratext width=\"11%\" bgColor=#ececec>Status</TD>\r\n                  <TD class=paratext width=\"7%\" bgColor=#ececec>&nbsp;</TD>\r\n ";
    echo "               </TR>\r\n\t\t\t\t";
    if ( $referal_list_num == "0" )
    {
        echo "                <TR onMouseOver=\"this.bgColor='gold';\" \r\n                    onmouseout=\"this.bgColor='#FFFFFF';\" bgColor=#ffffff>\r\n                  <TD class=smalltextgrey>&nbsp;</TD>\r\n                  <TD colspan=\"8\" align=\"center\" valign=\"middle\" class=\"messages\">Sorry No Affiliate Members List </TD>\r\n                </TR>\r\n\t\t\t\t";
    }
    $referal_select = mysql_query( "select distinct referred_id from referral_list" );
    do
    {
        if ( $referal_fetch = mysql_fetch_array( $referal_select ) )
        {
            $user_select = mysql_query( "select * from users where UserID='{$referal_fetch['referred_id']}'" );
            do
            {
            } while ( !( $user_fetch = mysql_fetch_array( $user_select ) ) );
            $refers = mysql_query( "select * from referral_list where referred_id='{$user_fetch['UserID']}'" );
            $refers_fetch = mysql_fetch_array( $refers );
            $refers_num = mysql_num_rows( $refers );
            $amount_paid = 0;
            $paidamount = mysql_query( "select * from user_paid_amount where UserID='{$user_fetch['UserID']}'" );
            while ( $paidamount_fetch = mysql_fetch_array( $paidamount ) )
            {
                $amount_paid = $amount_paid + $paidamount_fetch['Paidamount'];
            }
            $balance_amount = $refers_num * $refers_fetch['amount'] - $amount_paid;
            echo "                <TR onMouseOver=\"this.bgColor='gold';\" \r\n                    onmouseout=\"this.bgColor='#FFFFFF';\" bgColor=#ffffff>\r\n                  <TD class=smalltextgrey><IMG height=16 \r\n                        alt=\"InActive Profile\" \r\n                        src=\"images/icon7.gif\" \r\n                        width=19></TD>\r\n                  <TD class=smalltextgrey><a href=\"member_reg.php?regid=";
            echo $user_fetch['UserID'];
            echo "\">";
            echo $user_fetch['LoginID'];
            echo "</a></TD>\r\n                  <TD class=smalltextgrey>";
            echo $user_fetch['AddedDate'];
            echo "</TD>\r\n                  <TD class=smalltextgrey>";
            echo $refers_num;
            echo "</TD>\r\n                  <TD class=smalltextgreystyle=\"direction:rtl\">";
            echo $amount_paid;
            echo "</TD>\r\n                  <TD class=smalltextred>";
            echo $balance_amount;
            echo "</TD>\r\n                  <TD class=smalltextred>";
            if ( $user_fetch['ApprovalStatus'] == "1" )
            {
                echo "<strong><font color='green'>Active</font></strong>";
            }
            else
            {
                echo "<strong><font color='red'>In-Active</font></strong>";
            }
            echo "</TD>\r\n                  <TD class=smalltextred><a href=\"affiliate_member2.php?refid=";
            echo $user_fetch['UserID'];
            echo "\">Pay</a></TD>\r\n                </TR>\r\n\t\t\t\t";
        } while ( 1 );
    }
    echo "<TR>\r\n <TD class=smalltextgrey \r\n
	background=images/dot.gif \r\n colSpan=10 height=2></TD>\r\n
	
	                </TR>\r\n                <TR>\r\n                  <TD class=smalltextgrey \r\n                      background=images/dot.gif \r\n                      colSpan=10 height=2></TD>\r\n                </TR>\r\n              </TBODY>\r\n         ";
    echo " </TABLE>\r\n          <TABLE cellSpacing=2 cellPadding=2 width=\"98%\" align=center \r\n                  border=0>\r\n              <TBODY>\r\n                \r\n              </TBODY>\r\n          </TABLE>\r\n          <TABLE cellSpacing=2 cellPadding=2 width=\"98%\" align=center \r\n                  border=0>\r\n              <TBODY>\r\n                <TR>\r\n                  <TD><DIV align=right>";
    echo "<S";
    echo "PAN class=Partext1>Page 1 of 1 </SPAN></DIV></TD>\r\n                </TR>\r\n              </TBODY>\r\n          </TABLE></TD>\r\n      </TR>\r\n    </TBODY>\r\n  </TABLE>\r\n</FORM>\r\n";
}

session_start( );
include( "template.php" );
i can't find error please help me. Thanks... :)

Re: Parse error: parse error, expecting `T_WHILE'

Posted: Fri Aug 31, 2012 3:43 am
by social_experiment
Looks like the while statement for the innitial 'do' is in the incorrect place

Code: Select all

<?php
} while ( 1 ); // move this
    } // to here
?>

Re: Parse error: parse error, expecting `T_WHILE'

Posted: Fri Aug 31, 2012 3:55 am
by gaugererik
Hey,

Thanks i move it but page load on and on and on and can't stop.

Re: Parse error: parse error, expecting `T_WHILE'

Posted: Fri Aug 31, 2012 3:59 am
by social_experiment
Sounds like an infinite loop :| Can you explain how the code works, what it does and why it does it

Re: Parse error: parse error, expecting `T_WHILE'

Posted: Fri Aug 31, 2012 4:17 am
by gaugererik
Yes, the code go on infinite. And it's for AFFILIATE MEMBERS LIST with

this values.

Username Reg On No Of Reffers Paid Amount Balance Status.


I want to include here that when this code encoded it works perfectly but after decoded it's show an error of

Parse error: parse error, expecting `T_WHILE' in C:\wamp\www\xxx\xxx\affiliate_member.php on line 99

Re: Parse error: parse error, expecting `T_WHILE'

Posted: Fri Aug 31, 2012 8:53 am
by social_experiment
gaugererik wrote:I want to include here that when this code encoded it works perfectly but after decoded it's show an error of
Parse error: parse error, expecting `T_WHILE' in C:\wamp\www\xxx\xxx\affiliate_member.php on line 99
Can you please explain what you mean by encoded / decoded?