Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2009
    Location
    McKinleyville, CA
    Posts
    40
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Syntax error with an else statement

    This parse error is driving me nuts and I need some better eyes than I have. Here the message:

    Parse error: syntax error, unexpected T_ELSE in
    I can not see any unmatched brakets, missing semicolons, etc. If I remove the there lines of code around the else it runs fine without the second condition. I tried removing the condition and simply having the else and the expression, but that does not help. Any suggestions?

    PHP Code:
    while($qp_holder_count $count){
                
    $qp_holder_count $qp_holder_count 1;

            
    $row_quotapounds mysql_fetch_row($quotapounds);
            
    $row_qp_max mysql_fetch_row($qp_maximum);

            
    $times 29;
            
    $x 0;
            while(
    $x $times){
            
            if(
    $row_quotapounds[$x] <= $row_qp_max[$x]);{
            
    $species[$x] = $row_quotapounds[$x]; 
    }

    /////////////  Trouble spot ////////////
            
    else($row_quotapounds[$x] > $row_qp_max[$x]);{
            
    $species[$x] = $row_qp_max[$x];
    }

    $ID $species[0]; 
    $totalgf $species[1]; 
    $ling $species[2]; 
    $Pcod $species[3];
    $hake $species[4];
    $sablen $species[5];
    $sables $species[6];
    $pop $species[7];
    $widow $species[8];
    $canary $species[9];
    $chili $species[10];
    $boc $species[11];
    $splitnose $species[12];
    $yt $species[13];
    $ssn $species[14];
    $sss $species[15];
    $lsn $species[16];
    $cow $species[17];
    $darkb $species[18];
    $ye $species[19];
    $shelfn $species[20];
    $slopen $species[21];
    $shelfs $species[22];
    $slopes $species[23];
    $dover $species[24];
    $english $species[25];
    $pet $species[26];
    $arrow $species[27];
    $starry $species[28];
    $otherflats $species[29];
    $x $x 1;
    }

          
    mysql_select_db($database_connifq$connifq);
    mysql_query("INSERT INTO qp_roll_over (ID, totalgf, ling, Pcod, hake, sablen, sables, pop, widow, canary, chili, boc, splitnose, yt, ssn, sss, lsn, cow, darkb, ye, shelfn, slopen, shelfs, slopes, dover, english, pet, arrow, starry, otherflats) VALUES('$ID', '$totalgf', '$ling', '$Pcod', '$hake', '$sablen', '$sables', '$pop', '$widow', '$canary', '$chili', '$boc', '$splitnose', '$yt', '$ssn', '$sss', '$lsn', '$cow', '$darkb', '$ye', '$shelfn', '$slopen', '$shelfs', '$slopes', '$dover', '$english', '$pet', '$arrow', '$starry', '$otherflats')")or die(mysql_error());


  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    if($row_quotapounds[$x] <= $row_qp_max[$x]);{
    $species[$x] = $row_quotapounds[$x];
    }

    ///////////// Trouble spot ////////////
    else($row_quotapounds[$x] > $row_qp_max[$x]);{
    $species[$x] = $row_qp_max[$x];
    }
    I think you meant
    PHP Code:
     if($row_quotapounds[$x] <= $row_qp_max[$x]){
            
    $species[$x] = $row_quotapounds[$x]; 
    }
            elseif(
    $row_quotapounds[$x] > $row_qp_max[$x]){
            
    $species[$x] = $row_qp_max[$x];

    there

    PS:
    Code:
    if(some condition);{
    //do something
    }
    is equivalent to
    Code:
    if(some condition)
    ;//do nothing
    {
    //do something (always!)
    }
    Last edited by abduraooft; 02-02-2010 at 06:25 AM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    Fishhead (02-02-2010)

  • #3
    New Coder
    Join Date
    Aug 2009
    Location
    McKinleyville, CA
    Posts
    40
    Thanks
    3
    Thanked 0 Times in 0 Posts
    That does it. Tomorrow I make an appointment with the eye doctor.

    Thank you much.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •