Parse error: parse error, unexpected '&', expecting ','

A

Anonymous

Guest
Hi can somebody help, I am new to PHP and I am getting this error message:

Parse error: parse error, unexpected '&', expecting ',' or ';' in ..... on line 28

Any help would be greatly appreciated.

Thank in advance.

N.

Code Below
===========
<TABLE width="100%" border="0" cellpadding="10" cellspacing="0">
<table border="0" cellpadding="1" cellspacing="1" width="100%">
<tr>
<td class="EventTitle" valign="top" align="center" bgcolor="#D0F0D0">Pos</td>
<td class="EventTitle" valign="top" align="left" bgcolor="#D0F0D0">Team Name</td>
<td class="EventTitle" valign="top" align="center" bgcolor="#D0F0D0">Played</td>
<td class="EventTitle" valign="top" align="center" bgcolor="#D0F0D0">Won</td>
<td class="EventTitle" valign="top" align="center" bgcolor="#D0F0D0">Drawn</td>
<td class="EventTitle" valign="top" align="center" bgcolor="#D0F0D0">Lost</td>
<td class="EventTitle" valign="top" align="center" bgcolor="#D0F0D0">+ / -</td>
<td class="EventTitle" valign="top" align="center" bgcolor="#D1D1E9">Points</td>
<td class="EventTitle" valign="top" align="right" bgcolor="white">Last 6</td>
</tr>
<?
$db_handle = mysql_connect("default","root","");
msql_select_db("fixtures",$db_handle);
$myquery = msql_query("SELECT TableDate, Position, TeamID, TeamName, Played, Won, Drawn, Lost, GoalDifference, Points, TeamForm FROM LeagueTable",$db_handle);

while($rs = msql_fetch_array($myquery)){
if($BGColor == "#F7F7E7"){
$BGColor="#E7E7D6" ;
} else {
$BGColor="#F7F7E7";
}
?>
<div ALIGN="center">
<tr BGCOLOR="<?$BGColor?>">
<td class="description" valign="top" align="center"><?=&rs["Position"]?></td>
<td class="description" valign="top" align="left"><?=$rs["TeamName"]?></td>

<td class="description" valign="top" align="center"><?=&rs["Played"]?></td>
<td class="description" valign="top" align="center"><?=&rs["Won"]?></td>
<td class="description" valign="top" align="center"><?=&rs["Drawn"]?></td>
<td class="description" valign="top" align="center"><?=&rs["Lost"]?></td>
<td class="description" valign="top" align="center"><?=&rs["GoalDifference"]?></td>
<td class="description" valign="top" align="center" bgcolor="#D1D1E9"><?=&rs("Points")?></td>
<td class="description1" valign="top" bgcolor="white" align="right"><?=&rs["TeamForm"]?></td>
</tr>
<? } ?>
</table>
</div>
 
Neobis said:
Hi can somebody help, I am new to PHP and I am getting this error message:

Parse error: parse error, unexpected '&', expecting ',' or ';' in ..... on line 28

Any help would be greatly appreciated.

Thank in advance.

N.

Code Below
===========
<TABLE width="100%" border="0" cellpadding="10" cellspacing="0">
<table border="0" cellpadding="1" cellspacing="1" width="100%">
<tr>
<td class="EventTitle" valign="top" align="center" bgcolor="#D0F0D0">Pos</td>
<td class="EventTitle" valign="top" align="left" bgcolor="#D0F0D0">Team Name</td>
<td class="EventTitle" valign="top" align="center" bgcolor="#D0F0D0">Played</td>
<td class="EventTitle" valign="top" align="center" bgcolor="#D0F0D0">Won</td>
<td class="EventTitle" valign="top" align="center" bgcolor="#D0F0D0">Drawn</td>
<td class="EventTitle" valign="top" align="center" bgcolor="#D0F0D0">Lost</td>
<td class="EventTitle" valign="top" align="center" bgcolor="#D0F0D0">+ / -</td>
<td class="EventTitle" valign="top" align="center" bgcolor="#D1D1E9">Points</td>
<td class="EventTitle" valign="top" align="right" bgcolor="white">Last 6</td>
</tr>
<?
$db_handle = mysql_connect("default","root","");
msql_select_db("fixtures",$db_handle);
$myquery = msql_query("SELECT TableDate, Position, TeamID, TeamName, Played, Won, Drawn, Lost, GoalDifference, Points, TeamForm FROM LeagueTable",$db_handle);

while($rs = msql_fetch_array($myquery)){
if($BGColor == "#F7F7E7"){
$BGColor="#E7E7D6" ;
} else {
$BGColor="#F7F7E7";
}
?>
<div ALIGN="center">
<tr BGCOLOR="<?$BGColor?>">
<td class="description" valign="top" align="center"><?=&rs["Position"]?></td>
<td class="description" valign="top" align="left"><?=$rs["TeamName"]?></td>

<td class="description" valign="top" align="center"><?=&rs["Played"]?></td>
<td class="description" valign="top" align="center"><?=&rs["Won"]?></td>
<td class="description" valign="top" align="center"><?=&rs["Drawn"]?></td>
<td class="description" valign="top" align="center"><?=&rs["Lost"]?></td>
<td class="description" valign="top" align="center"><?=&rs["GoalDifference"]?></td>
<td class="description" valign="top" align="center" bgcolor="#D1D1E9"><?=&rs("Points")?></td>
<td class="description1" valign="top" bgcolor="white" align="right"><?=&rs["TeamForm"]?></td>
</tr>
<? } ?>
</table>
</div>

Hi!
You have a wrong code in your script you wrote:
Code:
<tr BGCOLOR="<?$BGColor?>">
:?:
need write
Code:
<tr BGCOLOR="<?echo ($BGColor)?>">
:!:

and next code you need change too.
 
Thanks wizard.

I am still getting the error :

Parse error: parse error, unexpected '&', expecting ',' or ';' in ..... on line 29

Line 29 is :

<td class="description" valign="top" align="center"><?=&rs["Position"]?></td>

Can you assist again?

Thanks.
 
Neobis said:
Thanks wizard.

I am still getting the error :

Parse error: parse error, unexpected '&', expecting ',' or ';' in ..... on line 29

Line 29 is :

<td class="description" valign="top" align="center"><?=&rs["Position"]?></td>

an you assist again?

Thanks.

I can help you.

Code:
<td class="description" valign="top" align="center"><?=$rs["Position"]; ?></td>

you forget to write ; after array element...
 
Your loop generating the table rows is full of errors. I've highlighted them in bold for you.

The first line should be:
<tr BGCOLOR="<?=$BGColor?>"> You left out the '=' sign.

All the table cell values should be in the format:
<?=$rs["keyName"]?>
You have used the '&' sign in several instances, and sometimes nothing at all. Also, for the 'Points' value, you have used curly brackets () instead of square brackets []
 
Back
Top