Delete a Rental Property

Note:
This will DELETE the property and all associated photographs. If you simply want to DEACTIVATE the property, click here.

"; //echo "$todel2
"; //exit; if (is_file($todel1)) { unlink($todel1); } if (is_file($todel2)) { unlink($todel2); } } // END while // Then delete them from the db $delpicsquery = " DELETE FROM photos WHERE listing_id = '$listing_id' "; // echo 'delpicsquery: '.$delpicsquery.'
'; // exit; $killpics = mysqli_query($dbcrent, $delpicsquery ) or trigger_error("Bad killpics: " . mysqli_error($dbcrent)); // Then delete the property from the db $killlistingquery = " DELETE FROM rentals WHERE listing_id = '$listing_id' "; // echo 'killlistingquery: '.$killlistingquery.'
'; // exit; $killlisting = mysqli_query($dbcrent, $killlistingquery) or trigger_error("Bad killlisting: " . mysqli_error($dbcrent)); if ($killlisting) { echo "

The property has been deleted.

"; echo "'; } } elseif ( isset($_POST['selectlisting'] ) ) { //display the delete listing form /////////// $listing_id = $_POST['listing_id']; $getlistinginfo = mysqli_query($dbcrent, " SELECT * FROM rentals WHERE listing_id = '$listing_id' ") or trigger_error("Bad getlistinginfo: " . mysqli_error($dbcrent)); while ($ary = mysqli_fetch_assoc($getlistinginfo)) { while (list($key,$val) = each($ary)) { $$key = $val; } ?>
Address: $city"; echo " $state $zip"; ?>
Select rental property to delete:"; $checkif = mysqli_query($dbcrent,"SELECT listing_id FROM rentals") or trigger_error("Bad checkif: " . mysqli_error($dbcrent)); if (mysqli_num_rows($checkif) < 1 ) { echo "

There are no properties to delete.

"; } else { ?>
0 ) { echo ""; } ?>