Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in list.php on line 10
is an error I get when I run this script. I am trying to do a simply row color alternating table with my sql results. Why am I getting this error?
<?php
// Begin your table outside of the array
echo"<table width=550 border=0 cellpadding=4 cellspacing=0>
<tr>
__<td><b>ID</b></td>
__<td><b>NAME</b></td>
<td><b>STYLE</b></td>
<td><b>STATE</b></td>
<td><b>CITY</b></td>
_</tr>";
// Define your colors for the alternating rows
$color1="#CCFFCC";
$color2="#BFD8BC";
$row_count=0;
//connect to the database
$connection = mysql_connect("localhost", "username", "password")
or die ("could not connect to the database");
//select the database
$db = mysql_select_db("database", $connection)
or die ("could not select the database");
// Defines the sql statement which adds the record to the table
$sql_statement = "SELECT * FROM VENUES";
//excute SQL query ad get results
$sql_results = mysql_query($sql_statement, $connection)
or die ("could not exectue a query of the database");
// We are going to use the "$row" method for this query. This is just my preference.
while($row=mysql_fetch_array($sql_results)){
_$venue_id=$row["VENUE_ID"];
$name=$row["NAME"];
$style=$row["STYLE"];
$state=$row["STATE"];
__$city=_$row["CITY"];
_/ Now we do this small line which is basically going to tell
_PHP to alternate the colors between the two colors we defined above. /
___$row_color=($row_count%2)?$color1:_$color2;
____// Echo your table row and table data that you want to be looped over and over here.
_echo"<tr bgcolor="$row_color">
<td>
$venue_id</td>
<td>
$name</td>
<td>
$style</td>
<td>
$state</td>
<td>
$city</td>
__</tr>";
____// Add 1 to the row count
____$row_count++;
}
// Close out your table.
echo_"</table>";