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="left"><a href="advanced_results.asp?TypeSearch=Team+Name&advquery=<?=rs["TeamName"]?>&B1=Search" onFocus="if(this.blur)this.blur()"><?=rs["TeamName"]?></a></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>
Parse error: parse error, unexpected '&', expecting ','
Moderators: egami, macek, gesf
- WiZARD
- Moderator
- Posts: 1240
- Joined: Thu Jun 20, 2002 10:14 pm
- Location: Ukraine, Crimea, Simferopol
- Contact:
Neobis wrote: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="left"><a href="advanced_results.asp?TypeSearch=Team+Name&advquery=<?=rs["TeamName"]?>&B1=Search" onFocus="if(this.blur)this.blur()"><?=rs["TeamName"]?></a></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: Select all
<tr BGCOLOR="<?$BGColor?>">

need write
Code: Select all
<tr BGCOLOR="<?echo ($BGColor)?>">
and next code you need change too.
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";


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.
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.
-
- Last Samuray
- Posts: 824
- Joined: Sun Jun 02, 2002 3:09 am
Neobis wrote: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: Select all
<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 []
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 []