Reputation: 183
how do i hyperlink an image and also pass a variable through it as well? my incorrect code is as follows:
<?php
$result=mysql_query("select serial, name, price from products ORDER BY RAND() LIMIT 3");
while($row=mysql_fetch_array($result))
{
echo '<a href="searchedproduct.php?product_id=<?=$row['serial']?>"><img src="getImage.php?id=' . $row['serial'] .'"/></a>'.' '.' ';
}
echo "</tr>";
echo "</table>";
?>
thanks for any help guys
Upvotes: 0
Views: 303
Reputation: 30741
as Book of Zeus said, you have a syntax error:
<?php
$result=mysql_query("select serial, name, price from products ORDER BY RAND() LIMIT 3");
while($row=mysql_fetch_array($result))
{
echo '<a href="searchedproduct.php?product_id='.$row['serial'].'"><img src="getImage.php?id=' . $row['serial'] .'"/></a>'.' '.' ';
}
echo "</tr>";
echo "</table>";
?>
Upvotes: 2