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
magicrobotmonkey
Forum Regular
Posts: 888 Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA
Post
by magicrobotmonkey » Wed Mar 24, 2004 3:38 pm
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>
PrObLeM
Forum Contributor
Posts: 418 Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:
Post
by PrObLeM » Wed Mar 24, 2004 3:57 pm
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
?>
tim
DevNet Resident
Posts: 1165 Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio
Post
by tim » Wed Mar 24, 2004 4:22 pm
you didnt end your while loop.
edit - ahh I didnt even see that problem already posted the solution
sorry prob.
PrObLeM
Forum Contributor
Posts: 418 Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:
Post
by PrObLeM » Wed Mar 24, 2004 4:25 pm
no problem
magicrobotmonkey
Forum Regular
Posts: 888 Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA
Post
by magicrobotmonkey » Wed Mar 24, 2004 5:26 pm
crap i dunno whats wrong with me! I got to stop coding in a hurry!