What is wrong with this code?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rich

    What is wrong with this code?

    I am trying to setup a set of radio buttons from a table. I am getting
    the error:
    Parse error: parse error, unexpected '[', expecting ',' or ';' in
    /var/www/html/liberty/prototype1.php on line 251
    This is the snippet of code.

    <?php
    $getnormwtA = getnormwt();
    $numct = count($getnormw tA);
    $tab = 16;
    $wt = 'weight';
    $typ = 'radio';
    for ($i=0; $i<$numct; $i++){
    echo "<input name=". $wt ." tabindex=". $tab ." value=".
    $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
    getnormwtA[$i]['bodyweightnorm '] .">";
    $tab++;
    ?> }
    ?>

    This is line 251

    echo "<input name=". $wt ." tabindex=". $tab ." value=".
    $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
    getnormwtA[$i]['bodyweightnorm '] .">";

    Any suggestions?

  • rich

    #2
    Re: What is wrong with this code?

    This is the actual code.

    <?php
    $getnormwtA = getnormwt();
    $numct = count($getnormw tA);
    $tab = 16;
    $wt = 'weight';
    $typ = 'radio';
    for ($i=0; $i<$numct; $i++){
    echo "<input name=". $wt ." tabindex=". $tab ." value=".
    $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
    getnormwtA[$i]['bodyweightnorm '] .">";
    $tab++;
    }
    ?>

    rich wrote:
    I am trying to setup a set of radio buttons from a table. I am getting
    the error:
    Parse error: parse error, unexpected '[', expecting ',' or ';' in
    /var/www/html/liberty/prototype1.php on line 251
    This is the snippet of code.
    >
    <?php
    $getnormwtA = getnormwt();
    $numct = count($getnormw tA);
    $tab = 16;
    $wt = 'weight';
    $typ = 'radio';
    for ($i=0; $i<$numct; $i++){
    echo "<input name=". $wt ." tabindex=". $tab ." value=".
    $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
    getnormwtA[$i]['bodyweightnorm '] .">";
    $tab++;
    ?>
    }
    ?>
    >
    This is line 251
    >
    echo "<input name=". $wt ." tabindex=". $tab ." value=".
    $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
    getnormwtA[$i]['bodyweightnorm '] .">";
    >
    Any suggestions?

    Comment

    • IchBin

      #3
      Re: What is wrong with this code?

      rich wrote:
      This is the actual code.
      >
      <?php
      $getnormwtA = getnormwt();
      $numct = count($getnormw tA);
      $tab = 16;
      $wt = 'weight';
      $typ = 'radio';
      for ($i=0; $i<$numct; $i++){
      echo "<input name=". $wt ." tabindex=". $tab ." value=".
      $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
      getnormwtA[$i]['bodyweightnorm '] .">";
      $tab++;
      }
      ?>
      >
      rich wrote:
      >I am trying to setup a set of radio buttons from a table. I am getting
      >the error:
      >Parse error: parse error, unexpected '[', expecting ',' or ';' in
      >/var/www/html/liberty/prototype1.php on line 251
      >This is the snippet of code.
      >>
      >
      ><?php
      >$getnormwtA = getnormwt();
      >$numct = count($getnormw tA);
      >$tab = 16;
      >$wt = 'weight';
      >$typ = 'radio';
      >for ($i=0; $i<$numct; $i++){
      >echo "<input name=". $wt ." tabindex=". $tab ." value=".
      >$getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
      >getnormwtA[$i]['bodyweightnorm '] .">";
      >$tab++;
      >?>
      }
      > ?>
      >>
      >This is line 251
      >>
      >echo "<input name=". $wt ." tabindex=". $tab ." value=".
      >$getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
      >getnormwtA[$i]['bodyweightnorm '] .">";
      >>
      >Any suggestions?
      >
      What array structure is getnormwt() returning into $getnormwtA. What
      does function getnormwt() look like.

      --
      Thanks in Advance...
      IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
      'If there is one, Knowledge is the "Fountain of Youth"'
      -William E. Taylor, Regular Guy (1952-)

      Comment

      • rich

        #4
        Re: What is wrong with this code?


        IchBin wrote:
        rich wrote:
        This is the actual code.

        <?php
        $getnormwtA = getnormwt();
        $numct = count($getnormw tA);
        $tab = 16;
        $wt = 'weight';
        $typ = 'radio';
        for ($i=0; $i<$numct; $i++){
        echo "<input name=". $wt ." tabindex=". $tab ." value=".
        $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
        getnormwtA[$i]['bodyweightnorm '] .">";
        $tab++;
        }
        ?>

        rich wrote:
        I am trying to setup a set of radio buttons from a table. I am getting
        the error:
        Parse error: parse error, unexpected '[', expecting ',' or ';' in
        /var/www/html/liberty/prototype1.php on line 251
        This is the snippet of code.
        >
        <?php
        $getnormwtA = getnormwt();
        $numct = count($getnormw tA);
        $tab = 16;
        $wt = 'weight';
        $typ = 'radio';
        for ($i=0; $i<$numct; $i++){
        echo "<input name=". $wt ." tabindex=". $tab ." value=".
        $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
        getnormwtA[$i]['bodyweightnorm '] .">";
        $tab++;
        ?>
        }
        ?>
        >
        This is line 251
        >
        echo "<input name=". $wt ." tabindex=". $tab ." value=".
        $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
        getnormwtA[$i]['bodyweightnorm '] .">";
        >
        Any suggestions?
        >
        What array structure is getnormwt() returning into $getnormwtA. What
        does function getnormwt() look like.
        >
        function getnormwt() {
        $getwtnormQ = "SELECT * FROM li_bodyweightno rm";
        $getwtnormR = pg_query($getwt normQ);
        $getwtnormA = pg_fetch_all(ge twtnormR);
        return($getwtno rmA);
        }
        --
        Thanks in Advance...
        IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
        'If there is one, Knowledge is the "Fountain of Youth"'
        -William E. Taylor, Regular Guy (1952-)

        Comment

        • Mateusz Markowski

          #5
          Re: What is wrong with this code?

          >echo "<input name=". $wt ." tabindex=". $tab ." value=".
          >$getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
          >getnormwtA[$i]['bodyweightnorm '] .">";
          $getnormwtA is an array, not function, so why did you write:
          getnormwtA[$i]['bodyweightnorm '] instead
          $getnormwtA[$i]['bodyweightnorm ']?

          Comment

          • IchBin

            #6
            Re: What is wrong with this code?

            Mateusz Markowski wrote:
            >echo "<input name=". $wt ." tabindex=". $tab ." value=".
            >$getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
            >getnormwtA[$i]['bodyweightnorm '] .">";
            >
            $getnormwtA is an array, not function, so why did you write:
            getnormwtA[$i]['bodyweightnorm '] instead
            $getnormwtA[$i]['bodyweightnorm ']?
            >
            That was the OP's problem. That is, the missing '$' in the front of
            getnormwtA.

            Just for clarity you should slow down while you are reading responses.
            What I asked the OP was:

            "What array structure is *getnormwt()* returning INTO *$getnormwtA*.
            What does function *getnormwt()* look like".

            --
            Thanks in Advance...
            IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
            'If there is one, Knowledge is the "Fountain of Youth"'
            -William E. Taylor, Regular Guy (1952-)

            Comment

            • Sandman

              #7
              Re: What is wrong with this code?

              In article <1157851650.688 319.256430@i3g2 000cwc.googlegr oups.com>,
              "rich" <rhdyes@gmail.c omwrote:
              I am trying to setup a set of radio buttons from a table. I am getting
              the error:
              Parse error: parse error, unexpected '[', expecting ',' or ';' in
              /var/www/html/liberty/prototype1.php on line 251
              This is the snippet of code.
              >
              <?php
              $getnormwtA = getnormwt();
              $numct = count($getnormw tA);
              $tab = 16;
              $wt = 'weight';
              $typ = 'radio';
              for ($i=0; $i<$numct; $i++){
              echo "<input name=". $wt ." tabindex=". $tab ." value=".
              $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
              getnormwtA[$i]['bodyweightnorm '] .">";
              $tab++;
              ?> }
              ?>
              >
              This is line 251
              >
              echo "<input name=". $wt ." tabindex=". $tab ." value=".
              $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
              getnormwtA[$i]['bodyweightnorm '] .">";
              ^^^^^^^^^^

              Missing "$":

              $getnormwtA[$i]['bodyweightnorm ']




              --
              Sandman[.net]

              Comment

              • Mateusz Markowski

                #8
                Re: What is wrong with this code?

                IchBin napisal(a):
                Mateusz Markowski wrote:
                echo "<input name=". $wt ." tabindex=". $tab ." value=".
                $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>".
                getnormwtA[$i]['bodyweightnorm '] .">";
                $getnormwtA is an array, not function, so why did you write:
                getnormwtA[$i]['bodyweightnorm '] instead
                $getnormwtA[$i]['bodyweightnorm ']?
                That was the OP's problem. That is, the missing '$' in the front of
                getnormwtA.
                >
                Just for clarity you should slow down while you are reading responses.
                What I asked the OP was:
                >
                "What array structure is *getnormwt()* returning INTO *$getnormwtA*.
                What does function *getnormwt()* look like".
                First it wasn't response to your post. Maybe I overlooked something but
                I have no idea why did you ask about getnormwt() if you had known that
                is the OP's problem?

                Comment

                Working...