Reputation: 37
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" '<a href="http://localhost/Test/AddLocation.php">. $row['id'] .</a>'</td>";
echo "<td>" . $row['LayarType'] . "</td>";
echo "<td>" . $row['Attribution'] . "</td>";
echo "</tr>";
}
it gives an error...
how do i give a link suggested here in bold part..
Upvotes: 0
Views: 6061
Reputation: 1184
Your quotes are messed up in the second echo.
Also, for strings with no variables inside them, you should use single quotes instead of double quotes so that PHP doesn't have to process the contents.
while($row = mysql_fetch_array($result))
{
echo '<tr>';
echo '<td><a href="http://localhost/Test/AddLocation.php?id='.$row['id'].'">'. $row['id'] .'</a></td>'; echo '<td>' . $row['LayarType'] . '</td>';
echo '<td>' . $row['Attribution'] . '</td>';
echo '</tr>';
}
Upvotes: 0
Reputation:
You were not concatenating the different strings with the .
operator.
Either of the following will work:
echo "<td>" . '<a href="http://localhost/Test/AddLocation.php">'. $row['id'] .'</a>' . "</td>";
// or
echo '<td><a href="http://localhost/Test/AddLocation.php">'. $row['id'] .'</a></td>';
Upvotes: 2