:::

1-3 show.php

<?php
$db = new mysqli('localhost', 'root', '12345', 'test');
$db->set_charset("utf8");

$sn     = $db->real_escape_string($_GET['sn']);
$sql    = "SELECT `type`,`content` FROM `canvas` where `sn`='{$sn}'";
$result = $db->query($sql) or die($db->error);

list($type, $content) = $result->fetch_row();

echo "<img src='data:" . $type . "," . $content . "'>";

$sql    = "SELECT * FROM `canvas` order by `sn` desc";
$result = $db->query($sql) or die($db->error);
while (list($sn, $type, $content) = $result->fetch_row()) {

    if (strpos($type, 'svg') !== false) {
        $pic = "{$sn}.svg";
    } else {
        $pic = "{$sn}.png";
    }

    echo "
    <div>
        <a href='show.php?sn=$sn'>
        <img src='$pic' style='width: 200px; border:1px solid gray; margin: 4px;'>
        </a>
    </div>";
}

echo '<a href="index.html">回首頁</a>';

 


:::

書籍目錄

展開 | 闔起

https%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1127%26tbsn%3D36

計數器

今天: 615615615
昨天: 2027202720272027
總計: 7971656797165679716567971656797165679716567971656