Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当点击图片时,如何在新的php页面上显示相同的图片?_Php_Mysql - Fatal编程技术网

当点击图片时,如何在新的php页面上显示相同的图片?

当点击图片时,如何在新的php页面上显示相同的图片?,php,mysql,Php,Mysql,这是我显示MySQL图片的代码 echo '<table>'; echo '<tr>'; echo '<td><a href="imagedisplay.php"><img src="galleryshow.php?id=' . $row['id'] .'" width="300" height="250" /></td>'; echo '<td><li>Species:'.$row['species

这是我显示MySQL图片的代码

echo '<table>';
echo '<tr>';
echo '<td><a href="imagedisplay.php"><img src="galleryshow.php?id=' . $row['id'] .'" width="300" height="250" /></td>';
echo '<td><li>Species:'.$row['species'].'</li><li>Age: '.$row['age'].'</li><li>Sex: '.$row['sex'].'</li><li>Date: '.$row['date'].'</li><li>Time: '.$row['time'].'</li><li>Location: '.$row['location'].'</li><li>Comment: '.$row['comment'].'</li></td>';
echo '</tr>';
echo '</table>';
echo';
回声';
回声';
回音“
  • 种类:”.$row['Species'。
  • 年龄:”.$row['Age'。
  • 性别:'.$row['Sex'。
  • 日期:'.$row['Date'.时间:'.$row['Time'.位置:'.$row['Location'.
  • 注释:'.$row['Comment'.
  • ; 回声'; 回声';

    我想在
    imagedisplay.php

    上显示相同的图片这不是什么答案,因为这不是什么问题:

    您需要将$row['id']作为参数传递给
    imagedisplay.php
    。使用
    GET
    它看起来像:

    echo'


    您必须在
    imagedisplay.php
    代码中提取该变量,然后像这里一样再次使用它。

    您需要查看
    $\u GET
    并将其作为
    imagedisplay.php
    的参数传递

    您的url应该类似于:

    <a href="imagedisplay.php?image=<?=$row['id'];?>">image_code</a>
    
    这应该会得到你的形象


    然而,如果这个图像实际上只显示在页面上,而没有其他内容,那么您可以创建一个指向该图像的链接,以便它在浏览器中打开,或者使用JavaScript在单击时放大

    ……
    然后在imagedisplay.php中检索id,您有什么问题?在imagedisplay.php中获取数据库的记录,并像这样显示。添加!很好的捕获:)谢谢你,这与我的php stater很多
    <img src="galleryshow.php?=<?=$_GET['image'];?>"/>