Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.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
来自MYSQL数据库的图像(PHP、MYSQL)_Php_Html_Mysql - Fatal编程技术网

来自MYSQL数据库的图像(PHP、MYSQL)

来自MYSQL数据库的图像(PHP、MYSQL),php,html,mysql,Php,Html,Mysql,我正在尝试将mysql数据库中的图像URL显示到我的网站中。它在我的数据库中保存为URL http://www.upload.ee/image/5697422/prague-1168302_1920.jpg 这是应该显示为$rida['pilt']的url <?php $paring = 'SELECT * FROM postitus ORDER BY id'; $valjund = $yhendus->query($paring); while($rida = mysq

我正在尝试将mysql数据库中的图像URL显示到我的网站中。它在我的数据库中保存为URL

http://www.upload.ee/image/5697422/prague-1168302_1920.jpg 
这是应该显示为$rida['pilt']的url

    <?php
$paring = 'SELECT * FROM postitus ORDER BY id';
$valjund = $yhendus->query($paring);
while($rida = mysqli_fetch_assoc($valjund))
    ?>

<img class="img-thumbnail" alt="city" src="<?php echo $rida['pilt']; ?>" style="width:250px;height:200px" />

“style=”宽度:250px;高度:200px“/>

我猜在您的代码中,当您在while循环外访问变量时,您会得到错误未定义索引。请尝试以下代码:

<?php
$paring = 'SELECT * FROM postitus ORDER BY id';
$valjund = $yhendus->query($paring);

while($rida = mysqli_fetch_assoc($valjund)) : ?>
    <img class='img-thumbnail' alt='city' src='<?php echo $rida['pilt']; ?>' style="width:250px;height:200px" />
<?php endwhile; ?>

'style=“宽度:250px;高度:200px“/>

我猜在您的代码中,当您在while循环外访问变量时,您会得到错误未定义索引。请尝试以下代码:

<?php
$paring = 'SELECT * FROM postitus ORDER BY id';
$valjund = $yhendus->query($paring);

while($rida = mysqli_fetch_assoc($valjund)) : ?>
    <img class='img-thumbnail' alt='city' src='<?php echo $rida['pilt']; ?>' style="width:250px;height:200px" />
<?php endwhile; ?>

'style=“宽度:250px;高度:200px“/>

使用“echo var_dump($rida)”后,应重新检查$rida;,您将知道数组中的所有参数。您可以选择信任数组。您应该重新检查$rida。使用“echo var_dump($rida)”后;“,您将知道数组中的所有参数。您可以选择“信任数组”

Remove while loop only Definite您的变量$RIDAI是否很难检查您的查询是否正确执行?Remove while loop only Definite您的变量$RIDAI是否很难检查您的查询是否正确执行?