Page 1 of 1

Post-script error?

Posted: Wed Mar 24, 2004 3:38 pm
by magicrobotmonkey
Lets say this is my code:

Code: Select all

<table>
  <tr>
    <td>
      <b>Year</b>
    </td>
    <td>
      <b>Quarter</b>
    </td>
  </tr>
<?

  while($choice = mysql_fetch_object($test_result, MYSQL_ASSOC)){
    echo "<tr>\n
            <td>\n
              $choice->Sel_Year\n
            </td>\n
            <td>\n
               $choice->Sel_Quarter\n
            </td>\n
          </tr>";
?>

</table>
And I get this error
Parse error: parse error, unexpected $ in c:\html\nhhp\rev.bdy on line 23



note line 23 is this: </table>

Posted: Wed Mar 24, 2004 3:57 pm
by PrObLeM
did you connect to the db? did you define $test_result? you also need a }

Code: Select all

<?php
while($choice = mysql_fetch_object($test_result, MYSQL_ASSOC)){
    echo "<tr>\n
            <td>\n
              $choice->Sel_Year\n
            </td>\n
            <td>\n
               $choice->Sel_Quarter\n
            </td>\n
          </tr>"; 
}//<----you need this right here
?>

Posted: Wed Mar 24, 2004 4:22 pm
by tim
you didnt end your while loop.

edit - ahh I didnt even see that problem already posted the solution

sorry prob.

Posted: Wed Mar 24, 2004 4:25 pm
by PrObLeM
no problem

Posted: Wed Mar 24, 2004 5:26 pm
by magicrobotmonkey
crap i dunno whats wrong with me! I got to stop coding in a hurry!