doq1969 2016-08-12 13:37
浏览 12
已采纳

将sql结果转换为PHP可点击链接

I have a program where a admin can upload a image into phpMyAdmin. What I want to achieve is a page to echo out all the pictures in a table data and the picture name is another table data using sql. Clicking the name will link to another page. The problem is that each picture has different name. How do I echo the picture name into a clickable link?

echo "<td>";?><img src="<?php echo $row["path"];?>" height="300" width="700"> <?php echo "</td>";

currently this is the code that I'm getting results from

  • 写回答

2条回答 默认 最新

  • doutuo3899 2016-08-12 14:56
    关注

    use:

    echo "<table><tr><td><a href='YourProcessPage.php?path=" . $row['path'] . "'>" . $row['path'] . "</a></td><td><img src='" . $row['path'] . "' height='300' width='700'></img></td></tr></table>";
    

    it will echo the link and the image in a table

    I always use it like this:

    $result = mysqli_query($database, "YourQueryHere");
    echo "<table>";
    while ($row = mysqli_fetch_array($result)) {
    echo "<tr><td><a href='YourProcessPage.php?path=" . $row['path'] . "'>" . $row['path'] . "</a></td><td><img src='" . $row['path'] . "' height='300' width='700'></img></td></tr>";
    }
    echo "</table>"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度