Hello,

index.php

<?php /*
        <img src="images/indonusa banner1.jpg" width="900px"/>
        <img src="images/indonusa banner2.jpg" width="900px"/>
        <img src="images/indonusa banner3.jpg" width="900px"/>   
        */ ?>

        <?php 
        include('include/con_database.php');
        $result2 = mysql_query("SELECT * FROM dynamic_content WHERE CatID='11' LIMIT 3");

        while ($data2 = mysql_fetch_array($result2)){
        echo '<td>'.'<img src="images/banner/'.$data2['images'].'" width="900px">'.'</td>';
        } 
        ?>  

In the following code:

        while ($data2 = mysql_fetch_array($result2)){
        echo '<td>'.'<img src="images/banner/'.$data2['images'].'" width="900px">'.'</td>';

        ?>  

Is it possible to print the text out such as :

"<img src="images/banner/image1.jpg" width="900px">"
"<img src="images/banner/image2.jpg" width="900px">"
"<img src="images/banner/image3.jpg" width="900px">"

Instead of showing the pictures?

Thanks in advance.

Recommended Answers

All 3 Replies

Yup. You can do something like this

$imageCode = htmlspecialchars('<img src="images/banner/'.$data2['images'].'" width="900px">');
echo '<td>'. $imageCode .'</td>';

Or even this would work

echo '<td>'. htmlspecialchars('<img src="images/banner/'.$data2['images'].'" width="900px">').'</td>';

The above php generates the following html codes:

<div id="demos">
<div id="slideshow" class="pics" style="position: relative;">

Connected successfully
<br style="position: absolute; top: 0px; left: 0px; display: block; z-index: 3; opacity: 1;">
<br style="position: absolute; top: 0px; left: 0px; display: none; z-index: 2; opacity: 0;">
<img src="images/banner/681325.jpg" width="900px"><img src="images/banner/260998880.jpg" width="900px"><img src="images/banner/50952964.jpg" width="900px">

</div>
<ul id="nav">
</div>

I wonder where these following css addition comes from:

<br style="position: absolute; top: 0px; left: 0px; display: block; z-index: 3; opacity: 1;">
<br style="position: absolute; top: 0px; left: 0px; display: none; z-index: 2; opacity: 0;">

since it makes an extra step (which shows blank banner) before it shows the real three banners (which I intended to shows).

It must be some other code on the page that is causing it, it is not possible for the code I gave you by it self to do that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.