Jump to content

ArchaicMedia

Members
  • Posts

    12
  • Joined

  • Last visited

ArchaicMedia's Achievements

Newbie

Newbie (1/5)

1

Reputation

  1. Oh Dear God it Works! Thank you so much! @Psycho - I didn't write the code but I will definitely work on what you are saying. Also I will head your warning of the testing server in the future. @CroNix - Thanks for all your help I couldn't have done it without you (At least not in any sort of reasonable time span : )) Thanks again. I had originally posted this on Stack Overflow but they laughed me out of the board. I can't thank you enough.
  2. Awesome! Now it is ordering by the address but it is not ordering the pr_live ones first.
  3. By "Up" I mean that I have it set to show errors. Currently there are no errors.
  4. Adding that to the file has it print (I also have PHP errors up.) Error: It is a live site but, it's in the admin section where you must be logged in.
  5. I've tried messing with the ORDER BY property.pr_street ASC to no avail.
  6. Currently the code is as follow: <?php /////////////// SEO /////////////// $keywords = ""; $description = ""; /////////////// DB Connection /////////////////// include('../includes/connect.php'); include('../includes/login.php'); if(isset($_GET['delete'])) { $del_id = $_GET['delete']; $query = "SELECT pr_img_id, pr_img_path_xl, pr_img_path_l, pr_img_path_m, pr_img_path_s, pr_img_path_xs FROM pr_imgs WHERE pr_id = '$del_id'"; $result = mysqli_query($db, $query); $deleteIDs = array(); while($row = mysqli_fetch_array($result)) { if(!empty($row['pr_img_path_xl'])){ unlink('..'.$row['pr_img_path_xl']); } if(!empty($row['pr_img_path_l'])){ unlink('..'.$row['pr_img_path_l']); } if(!empty($row['pr_img_path_m'])){ unlink('..'.$row['pr_img_path_m']); } if(!empty($row['pr_img_path_s'])){ unlink('..'.$row['pr_img_path_s']); } if(!empty($row['pr_img_path_xs'])){ unlink('..'.$row['pr_img_path_xs']); } $dir_to_remove = dirname(getcwd()).'/images/properties/'.$row['pr_img_id']; rmdir($dir_to_remove); } //Remove records for deleted id $deletedIDList = implode(); $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, $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 $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 pr_street ASC"; $result = mysqli_query($db,$query); $propertyList = ''; while($row = mysqli_fetch_assoc($result)) { $liveText = ($row['pr_live']) ? ' • <span class="live">Live</span>' : ''; $propertyList .= "<div class='property'>\n"; $propertyList .= " <div class='thumb'>\n"; $propertyList .= " <a href='/property_details.php?property={$row['pr_id']}'><img src='{$row['pr_img_path_s']}' width='100' height='100' /></a>\n"; $propertyList .= " </div>\n"; $propertyList .= " <div class='details'>\n"; $propertyList .= " <h4><a href='/property_details.php?property={$row['pr_id']}'>{$row['pr_title']}</a></h4>\n"; $propertyList .= " <ul>\n"; $propertyList .= " <li>Bedroom: {$row['pr_bedroom']} • Bathroom: {$row['pr_bathroom']}</li>\n"; $propertyList .= " <li class='adrs'>{$row['pr_street']}, {$row['pr_city']}, {$row['pr_state']} {$row['pr_zip']}</li>\n"; $propertyList .= " <li>Price: ${$row['pr_price']} 4 • Size: {$row['pr_size']} sq ft</li>\n"; $propertyList .= " <li>\n"; $propertyList .= " <a href='/admin/add-property.php?edit={$row['pr_id']}'>EDIT</a> •\n"; $propertyList .= " <a href='/admin/index.php?delete={$row['pr_id']}' class='red' onclick='return confirm('Are you sure you want to deletet this Property?');'>DELETE</a>{$liveText}\n"; $propertyList .= " </li>\n"; $propertyList .= " </ul>\n"; $propertyList .= " </div>\n"; $propertyList .= "</div>\n"; } 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 echo $propertyList; ?> </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'); ?>
  7. Great. It's all back but, it does not seem to be ordering by either the previous way or by the street address?
  8. Ok. This is the error I am getting Warning: mysqli_query() [function.mysqli-query]: Empty query in /mnt/stor1-wc1-dfw1/641050/642424/www.sunworldgroup.com/web/content/admin/index.php on line 59 Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in /mnt/stor1-wc1-dfw1/641050/642424/www.sunworldgroup.com/web/content/admin/index.php on line 62
  9. Nothing shows up. The content area is blank.
  10. Thanks again. You are correct I would like them "sorted as they are now and then sorted by 'pr_street'" I have tried your code and it errors out. I tried taking a look in win-merge so I could see the differences but, the differences are many and confusing : ). Can you give me another push in the right direction?
  11. Oh Great! I really appreciate it. I didn't write the code. It was just sent to me asking me to do this.
  12. 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'); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.