Search the Community
Showing results for tags 'alphabatecal'.
-
I got myself wrapped up in something I can't get figured. In the following code, I would like to order the list of properties ("<div class="property">") by the "$pr_street" variable. Any help is appreciated. Thanks, <?php /////////////// SEO /////////////// $keywords = ""; $description = ""; /////////////// DB Connection /////////////////// include('../includes/connect.php'); include('../includes/login.php'); if(isset($_GET['delete'])){ $del_id = $_GET['delete']; $sel_del_imgs_q = "SELECT * FROM pr_imgs WHERE pr_id = '$del_id'"; $pr_img_del_result = mysqli_query($db, $sel_del_imgs_q); while($pr_del_imgs = mysqli_fetch_array($pr_img_del_result)){ $pr_del_img_id[] = $pr_del_imgs['pr_img_id']; $pr_del_img_path_xl[] = $pr_del_imgs['pr_img_path_xl']; $pr_del_img_path_l[] = $pr_del_imgs['pr_img_path_l']; $pr_del_img_path_m[] = $pr_del_imgs['pr_img_path_m']; $pr_del_img_path_s[] = $pr_del_imgs['pr_img_path_s']; $pr_del_img_path_xs[] = $pr_del_imgs['pr_img_path_xs']; } for($i = 0; $i < count($pr_del_img_id);$i++){ if(!empty($pr_del_img_path_xl[$i])){ unlink('..'.$pr_del_img_path_xl[$i]); } if(!empty($pr_del_img_path_l[$i])){ unlink('..'.$pr_del_img_path_l[$i]); } if(!empty($pr_del_img_path_m[$i])){ unlink('..'.$pr_del_img_path_m[$i]); } if(!empty($pr_del_img_path_s[$i])){ unlink('..'.$pr_del_img_path_s[$i]); } if(!empty($pr_del_img_path_xs[$i])){ unlink('..'.$pr_del_img_path_xs[$i]); } } $dir_to_remove = dirname(getcwd()).'/images/properties/'.$del_id; rmdir($dir_to_remove); $delete_query = "DELETE property, pr_imgs FROM property LEFT OUTER JOIN pr_imgs ON property.pr_id = pr_imgs.pr_id WHERE property.pr_id = '$del_id'"; $deleted = mysqli_query($db, $delete_query); if($deleted){ header('Location:index.php'); //print $delete_query; } } $sel_pr_type = 1; // 1 = For Rent Residential, 2 = For Rent Commercial, 3 = For Sale $pr_sel_query = "SELECT * FROM property LEFT OUTER JOIN pr_imgs ON property.pr_id = pr_imgs.pr_id AND pr_imgs.pr_img_count = '0' ORDER BY property.pr_live DESC, property.pr_modified DESC"; $result = mysqli_query($db,$pr_sel_query); while($pr_row = mysqli_fetch_array($result)){ $pr_id[] = $pr_row[0]; $pr_type[] = $pr_row['pr_type']; $pr_live[] = $pr_row['pr_live']; $pr_title[] = $pr_row['pr_title']; $pr_street[] = $pr_row['pr_street']; $pr_city[] = $pr_row['pr_city']; $pr_state[] = $pr_row['pr_state']; $pr_zip[] = $pr_row['pr_zip']; $pr_price[] = $pr_row['pr_price']; $pr_bedroom[] = $pr_row['pr_bedroom']; $pr_bathroom[] = $pr_row['pr_bathroom']; $pr_size[] = $pr_row['pr_size']; $pr_img_path_s[] = $pr_row['pr_img_path_s']; } include('../includes/head.php'); include('../includes/header.php'); ob_end_flush(); // ob_start() in /includes/login.php ?> <div class="content"> <div class="hldr"> <?php if($loggedin){ ?> <div class="left"> <h2><a href="/admin/">Admin</a></h2> <?php for($i = 0; $i < count($pr_id); $i++){ if($pr_live[$i] == 1){ $islive[$i] = ' • <span class="live">Live</span>'; } ?> <div class="property"> <div class="thumb"><a href="/property_details.php?property=<?php print $pr_id[$i]; ?>"><img src="<?php print $pr_img_path_s[$i]; ?>" width="100" height="100" /></a></div> <div class="details"> <h4><a href="/property_details.php?property=<?php print $pr_id[$i]; ?>"><?php print $pr_title[$i]; ?></a></h4> <ul> <li>Bedroom: <?php print $pr_bedroom[$i]; ?> • Bathroom: <?php print $pr_bathroom[$i]; ?></li> <li class="adrs"><?php print $pr_street[$i].', '.$pr_city[$i].', '.$pr_state[$i].' '.$pr_zip[$i]; ?></li> <li>Price: $<?php print $pr_price[$i]; ?> 4 • Size: <?php print $pr_size[$i]; ?> sq ft</li> <li><a href="/admin/add-property.php?edit=<?php print $pr_id[$i]; ?>">EDIT</a> • <a href="/admin/index.php?delete=<?php print $pr_id[$i]; ?>" class="red" onclick="return confirm('Are you sure you want to deletet this Property?');">DELETE</a><?php print $islive[$i]; ?></li> </ul> </div> </div> <?php } ?> </div> <div class="right"> <div class="sidebarHome"> <div class="sidebarHome"> <p><strong><a href="/admin/">Admin Home</a></strong></p> <p><strong><a href="add-property.php">Add Property</a></strong></p> <p><strong><a href="for-rent-res.php">Edit Properties for Rent - Residential</a></strong></p> <p><strong><a href="for-rent-com.php">Edit Properties for Rent - Commercial</a></strong></p> <p><strong><a href="for-sale.php">Edit Properties for Sale </a></strong></p> <p><strong><a href="index.php?logout=1">Log Out </a></strong></p> </div> </div> <div class="clear"> </div> </div> <?php }else { ?> <div class="fullpage"> <div class="login"> <?php print $error_msg; ?> <form method="post" action="index.php"> <label>Username:</label> <input type="text" name="user" class="txt" /> <label>Password:</label> <input type="password" name="pass" class="txt" /><br /> <input type="submit" name="login" value="Login" class="submit" /> </form> </form> </div> </div> <?php } ?> </div> <?php include('../includes/footer.php'); ?>