I am trying to echo information into a slider , but, it keeps repeating the entire slider instead of jus inserting the fields aloone. i know it is the closing tag but i dont know how else to do it..any ideas? i just want to post like address 1 address 2 addreess 3 in decending order form the search.

<?php

while($row=mysql_fetch_array($result)){
$file=$row ['photourl'];




?>
        <div class="body2">
            <div class="main">
                <section id="content">
                    <div class="wrapper">
                        <article class="col1">

                            <div id="slider">
                              <img src="images/img1.jpg" alt="" title="<strong><?php echo $row['address'] ?></strong><span> <?php echo $row['bathroom'] . " bathrooms," .  $row['bedroom'] . " bedrooms"?> Price: <?php echo $row['price'] ?> &nbsp; &nbsp; <a href='view-prop.php?address=<?php echo $row['address'] ?>'>Read more</a></span>">
                                <img src="images/img2.jpg" alt="" title="<strong><?php echo $row['address'][1] ?></strong><span>8 rooms, 4 baths, 4 beds, building size: 4500 sq. ft. &nbsp; &nbsp; &nbsp; Price: $ 500 000 &nbsp; &nbsp; &nbsp; <a href='chateau-lingfield.html'>Read more</a></span>">
                                <img src="images/img3.jpg" alt="" title="<strong><?php echo $row['address'][2] ?><span>8 rooms, 4 baths, 4 beds, building size: 4500 sq. ft. &nbsp; &nbsp; &nbsp; Price: $ 500 000 &nbsp; &nbsp; &nbsp; <a href='property.html'>Read more</a></span>">

                            </div>

                        </article>
<?php
}
?>

Recommended Answers

All 2 Replies

Hi,

Move all these before the while loop..

 <div class="body2">
  <div class="main">
  <section id="content">
  <div class="wrapper">
  <article class="col1">
  <div id="slider">

and then after the closing curly bracket of your while loop, move these.

    </div>
    </article>

By the way, where is the opening tag of article?

Make sure any tag doesn't break.
Try below code i have used photourl as image src.

<div class="body2">
  <div class="main">
    <section id="content">
      <div class="wrapper">
        <article class="col1">
          <div id="slider">
            <?php
                while($row=mysql_fetch_array($result))
                {
                ?>
                <img src="<?php echo $row['photourl'] ?>" alt="" title="<strong><?php echo $row['address'] ?></strong><span> <?php echo $row['bathroom'] . " bathrooms," .  $row['bedroom'] . " bedrooms"?> Price: <?php echo $row['price'] ?>     <a href='view-prop.php?address=<?php echo $row['address'] ?>'>Read more</a></span>">
                <?php
                }
                ?>
          </div>
        </article>
      </div>
    </section>
  </div>
</div>
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.