如何使用php将网址转换为照片?

时间:2016-07-03 12:15:56

标签: php mysql

我必须插入数据库的链接。但它们应该在我的网站上作为照片打开吗?

        <?php
            if(isset($_SESSION['logged_in']) )
            { 
                $selektimi = 'SELECT titulli ,foto , pershkrimi FROM portofolio';
                $result = mysqli_query($conn, $selektimi) or die ('invalid query:'. mysqli_error($conn));

                    while($row = mysqli_fetch_row($result))
                        {
                            list( $titulli, $foto, $pershkrimi)=$row;
                            echo nl2br('<h2>'.$titulli.'</h2>');
                            echo '<img src="'.$row['$foto'].'">';

                            echo nl2br('<p>'.$pershkrimi.'</p>');
                            echo'<hr>';
                        }
               }
         ?>

1 个答案:

答案 0 :(得分:2)

<?php
//Connect to DB
//query
<img src="'.$row['url'].'">
//replace url with whatever your column name is
?>