Post-script error?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post-script error?

Post 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>
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post 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
?>
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

you didnt end your while loop.

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

sorry prob.
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

no problem
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

crap i dunno whats wrong with me! I got to stop coding in a hurry!
Post Reply