0

mysql テーブルから画像を取得したいと思います。現在、画像アイコンのみを取得しています。これを解決するのを手伝ってください。

<?php
include 'config.php';
$query = mysql_query("SELECT * FROM addproduct");
echo "<table border='1'>
        <thead>
            <th>PRODUCT</th>
            <th>PRICE</th>
            <th>QUANTITY</th>
            <th>IMAGE</th>
        </thead>";
    while ($row=mysql_fetch_array($query))
    {
        echo "<tr>";
        echo "<td>".$row['addProduct']."</td>";
        echo "<td>".$row['quantity']."</td>";
        echo "<td>".$row['price']."</td>";
        //header("Content-type: image/jpeg");
        //echo $row['image'];
        //echo "<td><img src=".$row['image']."</td>";
        echo "<td> <img src=" . $row['image'] . "></td>";
            //header("Content-type: image/jpeg");
        echo "</tr>";   
    }
echo "</table>";
?>
4

6 に答える 6

2

これをエコーすると何が見えます $row['image']か?

画像の URL が表示されますか?

于 2013-05-21T07:30:29.887 に答える
0

パスが正しいことを確認する必要があります。これはうまくいきます:

<?php
    include 'config.php';
    $query = mysql_query("SELECT * FROM addproduct");
    echo "<table border='1'>
            <thead>
                <th>PRODUCT</th>
                <th>PRICE</th>
                <th>QUANTITY</th>
                <th>IMAGE</th>
            </thead>";
        while ($row=mysql_fetch_array($query))
        {
            echo "<tr>";
            echo "<td>".$row['addProduct']."</td>";
            echo "<td>".$row['quantity']."</td>";
            echo "<td>".$row['price']."</td>";
            //header("Content-type: image/jpeg");
            //echo $row['image'];
            //echo "<td><img src=".$row['image']."</td>";
            echo "<td> <img src="/. $row['image'] . "></td>";
                //header("Content-type: image/jpeg");
            echo "</tr>";   
        }
    echo "</table>";
    ?>
于 2013-05-21T08:26:34.717 に答える
0

これを使って:-

<img src=<?php echo $row['image']; ?> width="200" height="180">

$row['image']画像のパスが含まれていると想定しています。

于 2013-05-21T06:53:20.333 に答える