php - While loop is repeating other elements in the page -
php - While loop is repeating other elements in the page -
hello have query while loop used retrieving info in here query
along while loop in top of page repeating other elements
header.
here code:
<?php require_once('../admin panel/db.php'); if(!empty($_post['province']) && !empty($_post['district']) && !empty($_post['radio'])) { $provincename=$_post['province']; $districtname=$_post['district']; $propertystatus=$_post['radio']; $query = "select properties.propertyid, properties.propertytype, properties.propertydealtype, properties.propertyregion, properties.propostedprice, properties.dealstatus, properties.currencytype, propertyimages.imageid, propertyimages.imagepath, propertyimages.imagename, provinces.provincename, districts.districtname, pds.pdname properties, provinces, districts, pds, propertyimages provinces.provinceid=properties.provinceid , districts.districtid=properties.districtid , pds.pdid=properties.pdid , properties.imageid=propertyimages.imageid , properties.status= 'active' , properties.propertystatus = 'approved' , provincename='".$provincename."' , districtname='".$districtname."' , propertydealtype='".$propertystatus."' grouping properties.propertyid"; $queryrun= $connection->query($query); // query run in here if( $connection->error ) exit( $connection->error ); // in here checks errors may occure in our query while ($row= $queryrun->fetch_assoc()) // storing value of query variable of row { $count= $queryrun->num_rows; // taking number of queries returened result ?> <!doctype html> <html> <head> <link rel="shortcut icon" href="favico.ico"> <meta charset="utf-8" /> <meta http-equiv="content-type" content=" spdealers onlince dealing," /> <meta name="keywords" content="spdealers.com - spdealers, property spdealers, property spdealers, real estate afghanistan, transitional islamic state of afghanistan property, transitional islamic state of afghanistan properties, property in afghanistan, property afghanistan, transitional islamic state of afghanistan real estate, apartments, properties sale afghanistan, office space, property, purchase property, sell property, rent property, commercial real estate afghanistan, transitional islamic state of afghanistan properties, transitional islamic state of afghanistan properties on sale, transitional islamic state of afghanistan property portals, transitional islamic state of afghanistan residential real estate, rental property, flats, apartments, studio apartments, property site,makaan, makan, spdealers.com, real estate properties, transitional islamic state of afghanistan real estate, real estate afghanistan, property afghanistan, transitional islamic state of afghanistan property portal, purchase property, sell property, rent property online, flats, apartments, studio apartment, rental property, commercial real estate, search property, list property, post requirement, featured builders, dealers, property index, properties in afghanistan, property localityproperty, properties, property sale, find property, properties sale, real estate, purchase real estate. r"> <meta name="description" content="spdealers online property dealing in afghansitan, property search, buy, sell, rent, lease residential, commercial propertys on spdealers.com."> <title>spdealers</title> <link rel="stylesheet" type="text/css" href="style.css" media="all" /> </head> <body> <div id="wrapper"> <div id="header"> <div id="logo"> <a href="../index.php"><img src="images/logo.png" alt="" /></a> </div> <ul> <li class="selected"><a href="index.php"><span>property</span></a></li> <li><a href="properties images page.php?province=<?php echo $provincename ?>&district=<?php echo $districtname ?>&propertystatus=<?php echo $propertystatus ?>" style="width:105px; text-align:left;">view option</a></li> <li><a href="../index.php"><span>home</span></a></li> </ul> </div> <div id="body"> <div class="header"> <div> <ul> <li></li> <li></li> <li></li> </ul> <div> <p>do want earn money , have income? want receive money without working hours , putting pressure level on mind, please contact , create 1 of our valuable remote employee <a href="myaccount.php" style="color:#069;">click here</a> more information.</p> </div> <div id="threeimages"> <img src="images/flags.png"> <img src="images/graph.png"> </div> </div> </div> <br> <div class="footer"> <div class="featured"> <div class="propertywrapperviewmore"> <div class="propertysingleimageviewmore"> <a href="property.php?imageid=<?php echo $row['imageid'] ?>"> <img src="../admin panel/property_insertion_files/<?php echo $row['imagepath'] ?>" width="227" height="147" alt="<?php echo $row['imagename'] ?>" style="border-radius:8px;" ></a> </div> <div class="propertyidviewmorelablevalue"> <div class="propertyidl">property id:</div> <div class="propertyidv"><?php echo $row['propertyid']?></div> <div align="right" style=" width:310px; height:15px; font-size:20px; float:right; padding-bottom:5px; background-color:#000; color:#fff; "><marquee behavior="scroll" scrollamount="2" onmouseover="this.scrollamount=1" onmouseout="this.scrollamount=6"><?php echo $row['propertydealtype'] ?></marquee></div> </div> <div class="propertysviewmoreotherlablevalue"> <div class="propertyothersl">property type:</div> <div class="propertyothersv"><?php echo $row['propertytype']?></div> </div> <div class="propertysviewmoreotherlablevalue"> <div class="propertyothersl">address:</div> <div class="propertyothersv"><?php echo $row['propertyregion'].' / nahya: '.$row['pdname'].' / district: '.$row['districtname'].' / '.$row['provincename']?></div> </div> <div class="propertysviewmoreotherlablevalue"> <div class="propertyothersl">total price:</div> <div class="propertyothersv"><?php $price = (isset($row['propostedprice']) && $row['propostedprice']!='')? number_format($row['propostedprice'], 2, '.', ','):''; echo $row['currencytype'].' '.$price?></div> </div> <div class="propertysviewmoreotherlablevalue"> <div class="propertyothersl">deal status:</div> <div class="propertyothersv"><?php echo $row['dealstatus']?></div> </div> <br><br><br><br> <div class="propertysviewmoredescription"> <div class="propertysviewmoredescriptionl">description:</div> <div class="propertysviewmoredescriptionv"> find out more property, please click on view more button. can contact more specific info on property. <label style="float:right;"><br><a href="property.php?imageid=<?php echo $row['imageid'] ?>" style="background-color:#f60; color:#fff; font-family:verdana, geneva, sans-serif; font-size:16px; text-decoration:none; font-weight:bold; border-radius:3px; padding:1px 10px; margin:7px 5px 0 0;">view more</a></label> <div> </div> </div> </div> </div> <?php } if($queryrun->num_rows == 0) { echo "<div style='margin-left:116px; line-height: 36px;'>".'sorry there no record search: '." ". "<br> province: <b>".$provincename."</b> <br>district: <b>". $districtname."</b> <br> property status: <b>".$propertystatus."</b> <br> search other provinces , cities <br> <a href='../index.php' style='text-decoration:none; font-size: 16px; color:#2a4f5e;'>click here</a> </div>"; } } else { echo '<br><br>you havent selected next properly:<br><br> <strong>(province)</strong> <br> <strong>(district)</strong> <br> <strong>(property status)</strong>.<br><br>'; echo "please <a href='../index.php' style='text-decoration:none; font-size: 16px; color:#2a4f5e;'>click here</a> go back"; } ?> </div> <div id="ads" style="margin-left:844px;"> <div id="adsone"></div> <div id="adsthree"></div> </div> </div> </div> <div id="footer"> <div id="bottomoptions"><a href="../index.php">home</a> <a href="about.php"> us</a> <a href="advertise/advertise.php">advertise us</a> <a href="#"> terms&condition </a> <a href="help.php"> help&support</a> <a href="privacy.php">privacy policy</a> <a href="#"> faq</a> <a href="contactus/contact.php"> contact us</a> <a href="contactus/contact.php"> study problem</a> <div id="copyright"><p>all rights reserved©2014 spdealers.com</p> </div> </div> </div> </div> </body> </html>
i guessing loop supposed , breaks should on if
else
conditions. should close...??
<?php require_once('../admin panel/db.php'); class provinceprop { protected $connection; public function __construct($connection) { $this->connection = $connection; } public $provincename; public $districtname; public $propertystatus; public $num_rows; public function processpost() { if(!empty($_post['province']) && !empty($_post['district']) && !empty($_post['radio'])) { $this->provincename = $_post['province']; $this->districtname = $_post['district']; $this->propertystatus = $_post['radio']; $query = "select properties.propertyid, properties.propertytype, properties.propertydealtype, properties.propertyregion, properties.propostedprice, properties.dealstatus, properties.currencytype, propertyimages.imageid, propertyimages.imagepath, propertyimages.imagename, provinces.provincename, districts.districtname, pds.pdname properties, provinces, districts, pds, propertyimages provinces.provinceid=properties.provinceid , districts.districtid=properties.districtid , pds.pdid=properties.pdid , properties.imageid=propertyimages.imageid , properties.status= 'active' , properties.propertystatus = 'approved' , provincename='".$this->provincename."' , districtname='".$this->districtname."' , propertydealtype='".$this->propertystatus."' grouping properties.propertyid"; // query run in here $queryrun = $this->connection->query($query); // in here checks errors may occure in our query if( $this->connection->error ) exit( $this->connection->error ); $this->num_rows = $queryrun->num_rows; // storing value of query variable of row while ($res = $queryrun->fetch_assoc()) { $array[] = $res; } // homecoming array or homecoming 0 (false) homecoming (isset($array))? $array: 0; } } } // start instance, feed in database connection $_property = new provinceprop($connection); // see if there rows returned (greater or equal 0) or empty // empty signifies criteria generate sql not satisfied $array = $_property->processpost(); ?><!doctype html> <html> <head> <link rel="shortcut icon" href="favico.ico"> <meta charset="utf-8" /> <meta http-equiv="content-type" content=" spdealers onlince dealing," /> <meta name="keywords" content="spdealers.com - spdealers, property spdealers, property spdealers, real estate afghanistan, transitional islamic state of afghanistan property, transitional islamic state of afghanistan properties, property in afghanistan, property afghanistan, transitional islamic state of afghanistan real estate, apartments, properties sale afghanistan, office space, property, purchase property, sell property, rent property, commercial real estate afghanistan, transitional islamic state of afghanistan properties, transitional islamic state of afghanistan properties on sale, transitional islamic state of afghanistan property portals, transitional islamic state of afghanistan residential real estate, rental property, flats, apartments, studio apartments, property site,makaan, makan, spdealers.com, real estate properties, transitional islamic state of afghanistan real estate, real estate afghanistan, property afghanistan, transitional islamic state of afghanistan property portal, purchase property, sell property, rent property online, flats, apartments, studio apartment, rental property, commercial real estate, search property, list property, post requirement, featured builders, dealers, property index, properties in afghanistan, property localityproperty, properties, property sale, find property, properties sale, real estate, purchase real estate. r"> <meta name="description" content="spdealers online property dealing in afghansitan, property search, buy, sell, rent, lease residential, commercial propertys on spdealers.com."> <title>spdealers</title> <link rel="stylesheet" type="text/css" href="style.css" media="all" /> </head> <body> <div id="wrapper"> <?php // guessing conditions met display required.... if(isset($_property->provincename)) { ?> <!--start header class --> <div id="header"> <div id="logo"><a href="../index.php"><img src="images/logo.png" alt="" /></a></div> <ul> <li class="selected"><a href="index.php"><span>property</span></a></li> <li><a href="properties images page.php?province=<?php echo $_property->provincename ?>&district=<?php echo $_property->districtname ?>&propertystatus=<?php echo $_property->propertystatus ?>" style="width:105px; text-align:left;">view option</a></li> <li><a href="../index.php"><span>home</span></a></li </ul> </div> <!--start body class --> <div id="body"> <div class="header"> <div> <ul> <li></li> <li></li> <li></li> </ul> <div> <p>do want earn money , have income? want receive money without working hours , putting pressure level on mind, please contact , create 1 of our valuable remote employee <a href="myaccount.php" style="color:#069;">click here</a> more information.</p> </div> <div id="threeimages"> <img src="images/flags.png"> <img src="images/graph.png"> </div> </div> </div> <div class="footer"> <div class="featured"><?php // if array returned (ie rows returned db) if(is_array($array)) { // here start of loop guessing be...?? foreach($array $row) { ?> <div class="propertywrapperviewmore"> <div class="propertysingleimageviewmore"> <a href="property.php?imageid=<?php echo $row['imageid'] ?>"> <img src="../admin panel/property_insertion_files/<?php echo $row['imagepath'] ?>" width="227" height="147" alt="<?php echo $row['imagename'] ?>" style="border-radius:8px;" ></a> </div> <div class="propertyidviewmorelablevalue"> <div class="propertyidl">property id:</div> <div class="propertyidv"><?php echo $row['propertyid']?></div> <div align="right" style="width:310px; height:15px; font-size:20px; float:right; padding-bottom:5px; background-color:#000; color:#fff;"> <marquee behavior="scroll" scrollamount="2" onmouseover="this.scrollamount=1" onmouseout="this.scrollamount=6"><?php echo $row['propertydealtype'] ?></marquee> </div> </div> <div class="propertysviewmoreotherlablevalue"> <div class="propertyothersl">property type:</div> <div class="propertyothersv"><?php echo $row['propertytype']?></div> </div> <div class="propertysviewmoreotherlablevalue"> <div class="propertyothersl">address:</div> <div class="propertyothersv"><?php echo $row['propertyregion'].' / nahya: '.$row['pdname'].' / district: '.$row['districtname'].' / '.$row['provincename']?></div> </div> <div class="propertysviewmoreotherlablevalue"> <div class="propertyothersl">total price:</div> <div class="propertyothersv"> <?php $price = (isset($row['propostedprice']) && $row['propostedprice']!='')? number_format($row['propostedprice'], 2, '.', ','):''; echo $row['currencytype'].' '.$price?></div> </div> <div class="propertysviewmoreotherlablevalue" style="margin-bottom: 60px;"> <div class="propertyothersl">deal status:</div> <div class="propertyothersv"><?php echo $row['dealstatus']?></div> </div> <div class="propertysviewmoredescription"> <div class="propertysviewmoredescriptionl">description:</div> <div class="propertysviewmoredescriptionv">to find out more property, please click on view more button. can contact more specific info on property. <label style="float:right;"><br><a href="property.php?imageid=<?php echo $row['imageid'] ?>" style="background-color:#f60; color:#fff; font-family:verdana, geneva, sans-serif; font-size:16px; text-decoration:none; font-weight:bold; border-radius:3px; padding:1px 10px; margin:7px 5px 0 0;">view more</a></label> <div> </div> </div> <?php } } ?> </div> </div> <?php } if(isset($_property->num_rows) && $_property->num_rows == 0) { ?> <div style='margin-left:116px; line-height: 36px;'>sorry there no record search: <br> province: <b><?php echo $provincename; ?></b> <br>district: <b><?php echo $districtname; ?></b> <br> property status: <b><?php echo $propertystatus; ?></b> <br> search other provinces , cities<br> <a href='../index.php' style='text-decoration:none; font-size: 16px; color:#2a4f5e;'>click here</a> </div><?php } else { ?> <br><br>you havent selected next properly:<br><br> <strong>(province)</strong> <br> <strong>(district)</strong> <br> <strong>(property status)</strong>.<br><br> please <a href='../index.php' style='text-decoration:none; font-size: 16px; color:#2a4f5e;'>click here</a> go back<?php } ?> </div> <div id="ads" style="margin-left:844px;"> <div id="adsone"></div> <div id="adsthree"></div> </div> </div> </div> <div id="footer"> <div id="bottomoptions"><a href="../index.php">home</a> <a href="about.php"> us</a> <a href="advertise/advertise.php">advertise us</a> <a href="#"> terms&condition </a> <a href="help.php"> help&support</a> <a href="privacy.php">privacy policy</a> <a href="#"> faq</a> <a href="contactus/contact.php"> contact us</a> <a href="contactus/contact.php"> study problem</a> <div id="copyright"><p>all rights reserved©2014 spdealers.com</p></div> </div> </div> </div> </body> </html>
php
Comments
Post a Comment