nick_whitmarsh Posted May 27, 2007 Share Posted May 27, 2007 Hi, I have some code which loops whilst there are some results in the database. These are displayed inside a while loop. However any div inside the loop does not display. <?php while($row= mysql_fetch_array($result)) { if ($row['picture'] == "") { $FILENAME = "imageunavailable.png"; } else { $FILENAME = $row['picture']; } ?> <img src= "pictures/<?php echo ($FILENAME)?>" width = "153" height = "150" border="0"> </div> <div id="profile2"><?php echo $row['FIRSTNAME']?> <?php echo $row['SURNAME']?></div> <div id="profile2-2">Email 1: <?php echo $row['email1']?> <br /> Email 2: <?php echo $row['email2']?> <br /> Mobile: <?php echo $row['mobilenumber']?></div> <div id="profile3">About me<span class ="image2"><img src="../graphics/group.gif" align="middle" /></span></div> <div id="profile3-3"><?php echo $row['aboutme']?> </div> <div id="profile14">Photo</div> <div id="profile10">Friends<span class ="image6"><img src="../graphics/group.gif" align="middle" /></span></div> <div id="profile4">Favourite Holiday(s)<span class ="image3"><img src="../graphics/group.gif" align="middle" /></span></div> <div id="profile11"> <p>php here for friends </p> </div> <div id="profile4-4"><?php echo $row['favholidays']?> </div> <div id="profile5">Next Holiday:<span class ="image4"><img src="../graphics/group.gif" align="middle" /></span></div> <div id="profile5-5"><?php echo $row1['resort']?> </div> <div id="profile6">Comments<span class ="image5"><img src="../graphics/group.gif" align="middle" /></span></div> <div id="profile12">Past Holidays<span class ="image7"><img src="../graphics/group.gif" align="middle" /></span></div> <?php } ?> <form id="form1" name="form1" method="post" action=""> <div id="profile8"> <textarea name="textarea" cols="41" rows="4"></textarea> </div> <div id="profile13"> <p> <?php while($row2= mysql_fetch_array($result2)) { echo $row2['resort']; ?> <br> <?php } ?> past holidays </p> </div> <div id="profile9"> <input type="submit" name="Submit2" value="Post" style="color: white; background-color:#003399" /> </div> <div id="profile7"> <p>!php for comments here! </p> </div> </form> Could anyone see my problem. I have tried ending the loop in many places. Many thanks Quote Link to comment https://forums.phpfreaks.com/topic/53210-while-loop-and-div-problem/ Share on other sites More sharing options...
chronister Posted May 27, 2007 Share Posted May 27, 2007 Try ensuring that your query is returning results. while($row= mysql_fetch_array($result)) { echo mysql_num_rows($result); Quote Link to comment https://forums.phpfreaks.com/topic/53210-while-loop-and-div-problem/#findComment-262877 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.