0

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.

2
Contributors
3
Replies
24
Views
3 Years
Discussion Span
Last Post by pixelsoul
1

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>';
0

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).

1

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.