我如何超链接图像并通过它传递变量?我的错误代码如下:
<?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>";
?>
感谢任何帮助人员
答案 0 :(得分:2)
正如宙斯之书所说,你有一个语法错误:
<?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>";
?>