I want to display a table on the screen so that the users can click on an item and edit it.
So i need to make one of the items from the database a clickable link. I have the following code
$sql="SELECT CategoryID, CategoryName, Description, " .
"Date, Person " .
"FROM Category";
$result = mysql_query($sql);
$nrows = mysql_num_rows($result);
if($nrows != 0)
{
print "<table border=2><tr><th>CategoryID<th>CategoryName<th>Description<th>Date<th>Person\n";
for($j=0;$j<$nrows;$j++)
{
$CategoryID = $row["CategoryID"];
$CategoryName= $row["CategoryName"];
$row = mysql_fetch_array($result);
print "<tr><td>" . $row["CategoryID"];
print "<td>"<a href="cat_details.php?CategoryID=$CategoryID"
title="Click to edit the Category $CategoryName">$CategoryName</td>
print "<td>" . $row["Description"];
print "<td>" . $row["Date"];
print "<td>" . $row["Person"];
print "\n";
}
print "</table>\n";
}
mysql_close($dbcon);
?>
This gives me a Parse error: parse error, unexpected T_STRING error on line 16 where I am trying to send the URL. Am i doing something stupidly wrong or is there a better way to achieve this?
Any help appreciated.