Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hello all
I am developing a site for a estate agent and am not able to edit the record from mysql database.
When I take my curser on to the edit link it shows the record id.
http://localhost/admin/edit_property.php?id=9 (ie) it seems to identify the id but does not show data in the record the record.
here is what is written in the delete_property.phpCode: Select all
<?php require("stuff.php");
require("validate_user.php");
$property_edited = false;
if (isset($_POST['submit'])) {
$edit_property = $_POST['edit_property'];
$property_type = $_POST['property_type'];
$contract = $_POST['contract'];
$bedrooms = $_POST['bedrooms'];
$property_details = $_POST['property_details'];
$property_value = $_POST['property_value'];
$area = $_POST['area'];
$id = $_POST['id'];
if (isset($edit_property) && ($edit_property == "validated"))
$property_details = trim($property_details);
$property_value = trim($property_value);
if (is_numeric($property_value)) {
$db_connection = db_connect();
$query = "UPDATE houses SET property_type='$property_type', contract='$contract', bedrooms='$bedrooms', details='$property_details', value='$property_value', area='$area' WHERE id='$id'";
db_query($query, $db_connection);
if (is_uploaded_file($property_image)) {
// there was a file uploaded with the product
$image_properties = getimagesize($property_image);
if ($image_properties[2] == 2) {
// the file was a valid image
$image_width = $image_properties[0];
$image_height = $image_properties[1];
$new_width = 175;
if ($image_width > $new_width) {
// the image is too big, so we must resize it
$ratio = $new_width / $image_width;
$new_height = $image_height*$ratio;
$image = ImageCreateFromJPEG($property_image);
$new_image = ImageCreateTrueColor($new_width, $new_height);
ImageCopyResized($new_image,$image,0,0,0,0,$new_width,$new_height,$image_width,$image_height);
ImageJPEG($new_image, $property_image);
}
$image_name = "C:\Program Files\Apache Group\Apache\htdocs\pictures\property_".$id.".jpg";
copy($property_image, $image_name);
}
}
db_disconnect($db_connection);
$property_edited = true;
}
}
?>