I am in process of learning php/html while I create (or mangle!) what I am working on. I have a php page calling to a mysql database of music albums I own, I was doing good, had the page up, and decided to add an option to delete rows out of the database, and the line I just added in has an error somewhere, I for the life of me can't figure out where I went wrong, I've tried tons of different ways and just cant seem to get it to work.
Here is the error I am getting:
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/content/E/l/d/Elderain/html/albumdb.php on line 46
my code:
<html>
<head>
<title>Album Database</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body>
<?php
include("connect.php");
$con=mysql_connect("$server","$user","$password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
echo "<table>
<tr>
<td width=50>#</td>
<td width=300>Artist</td>
<td width=300>Album Name</td>
<td width=100>Release Year</td>
<td width=100>Bit Rate</td>
<td width=50>Delete</td>
</tr>";
$color1 = "#003366";
$color2 = "#0066cc";
$row_count = 0;
mysql_select_db("$database", $con);
$result = mysql_query("SELECT * FROM album_info order by artist");
while($row = mysql_fetch_array($result))
{
$row_color = ($row_count % 2) ? $color1 : $color2;
$id=$r["id"];
$title=$r["title"];
echo "<tr>
<td width=50 bgcolor=.$row_color.>".$row['id']."</td>
<td width=300 bgcolor=.$row_color.>".$row['artist']."</td>
<td width=300 bgcolor=.$row_color.>".$row['album_name']."</td>
<td width=100 bgcolor=.$row_color.>".$row['release_year']."</td>
<td width=100 bgcolor=.$row_color.>".$row['bit_rate']."</td>
<td width=50 align=center bgcolor=.$row_color.>"<a href="delete.php?cmd=delete&id=$id">$title - Delete</a>"</td>
</tr>";
$row_count++;
}
echo "</table>";
mysql_close($con)
?>
<br>
<br>
<form method="link" action="submitnewalbum.php">
<input type="submit" value="Add A New Album">
</form>
</body>
</html>
the line giving trouble, and the one of the few new ones I added is:
<td width=50 align=center bgcolor=.$row_color.>"<a href="delete.php?cmd=delete&id=$id">$title - Delete</a>"</td>
I am thinking its obviously a misplaced or just missing " ' ; ; , something! I am pulling my hair out 😕 and another set of eyes and some more experienced people might be able to help 🙂
Any ideas?