使用 PHP,在搜索中如何在来自 MySql 数据库的图像中包含 html 链接?
这是我的问题:我有一个电子商务网站,我希望我的搜索结果能够提供其链接位于搜索页面上的产品图像内或图像旁边的产品。我当前的代码如下所示:
if($_GET['searchBox'] !='')
{
if(mysql_num_rows($searchresult)==0) {
echo 'Your search returned no results';
}
else
{
while ($row = mysql_fetch_assoc($searchresult))]
{
echo "<img src='".$row['image']."'/>".' '.$row['name'].' £'.$row['price'].' '.$row['ProductUrl'];
}
}
}
?>
我花了很长时间尝试将 URL 放入图像区域,但无法使其工作。
请帮忙!!
This is my problem: I have an ecommerce website, and I would like my search results to come up with products that have their links avaiable either within the image of the product on the search page, or next to the image. My current code looks like this:
if($_GET['searchBox'] !='')
{
if(mysql_num_rows($searchresult)==0) {
echo 'Your search returned no results';
}
else
{
while ($row = mysql_fetch_assoc($searchresult))]
{
echo "<img src='".$row['image']."'/>".' '.$row['name'].' £'.$row['price'].' '.$row['ProductUrl'];
}
}
}
?>
I have spent ages trying to get an URL into the image area, but I can't make it work.
Please help!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将图像放入锚标记时出现什么问题。
你有没有尝试过这样
编辑
What the problem put image in to the anchor tag.
Have you tried like this
EDIT