This is what I've got: (I found no $result, or even submit)
<?php
$db = mysql_connect('localhost', '', '') or die( "Unable to connect" );
mysql_select_db("test",$db);
if($addproperty == 'yes') {
$feature = '0';
if($featured == 'yes') {
$query = mysql_query("select max(featured) from properties");
$row = mysql_fetch_array($query);
$feature = $row[0] + 1;
}
$query = mysql_query("insert into properties
(location, listing_type, price, mls, prop_status, year_built, sq_ft, con_type, beds, baths, fam_rm, pantry, heating, cooling, garage, fenced_yd, hextra1, hextra2, hextra3, hextra4, hdescription,
lot_size, acres, surveyed, land_split, access, bpublic, irrigated, water_rights, land_water, well, power, phone, septic, fenced, landscaping, garden, livestock, lextra1, lextra2, lextra3, lextra4, pic1, pic2, pic3, pic4, pic5, pic6, featured)
values
('$location', '$listing_type', '$price', '$mls', '$prop_status', '$year_built', '$sq_ft', '$con_type', '$beds', '$baths', '$fam_rm', '$pantry', '$heating', '$cooling', '$garage', '$fenced_yd', '$hextra1', '$hextra2', '$hextra3', '$hextra4', '$hdescription', '$lot_size', '$acres', '$surveyed', '$land_split', '$access', '$bpublic', '$irrigated', '$water_rights', '$land_water', '$well', '$power', '$phone', '$septic', '$fenced', '$landscaping', '$garden', '$livestock', '$lextra1', '$lextra2', '$lextra3', '$lextra4', '$pic1', '$pic2', '$pic3', '$pic4', '$pic5', '$pic6', '$feature')
") or die (mysql_error());
}
?>
This is just the add.php page (used to add properties to the db). The edit.php page is similar (used to query the db and update):
<?php include 'top.php'; ?>
<?php
if($editproperty == 'yes') {$db = mysql_connect('localhost', '', '') or die( "Unable to connect" );
mysql_select_db("test",$db);
$feature = '0'; if($featured == 'yes') {$query = mysql_query("select featured from properties order by featured desc limit 1");
$row = mysql_fetch_array($query); $feature = $row[0] + 1;}
mysql_query("update properties set
location = '$location', listing_type = '$listing_type', price = '$price', mls = '$mls', prop_status = '$prop_status', year_built = '$year_built', sq_ft = '$sq_ft', con_type = '$con_type', beds = '$beds', baths = '$baths', fam_rm = '$fam_rm', pantry = '$pantry', heating = '$heating', cooling = '$cooling', garage = '$garage', fenced_yd = '$fenced_yd', hextra1 = '$hextra1', hextra2 = '$hextra2', hextra3 = '$hextra3', hextra4 = '$hextra4', hdescription = '$hdescription', lot_size = '$lot_size', acres = '$acres', surveyed = '$surveyed', land_split = '$land_split', access = '$access', bpublic = '$bpublic', irrigated = '$irrigated', water_rights = '$water_rights', land_water = '$land_water', well = '$well', power = '$power', phone = '$phone', septic = '$septic', fenced = '$fenced', landscaping = '$landscaping', garden = '$garden', livestock = '$livestock', lextra1 = '$lextra1', lextra2 = '$lextra2', lextra3 = '$lextra3', lextra4 = '$lextra4', pic1 = '$pic1', pic2 = '$pic2', pic3 = '$pic3', pic4 = '$pic4', pic5 = '$pic5', pic6 = '$pic6', featured = '$feature' where id = '$id'");
echo "<center><font color='red' size = '+1'>Update Successful</font></center>";
}?>
<?php
$db = mysql_connect('localhost', '', '') or die( "Unable to connect" );
mysql_select_db("test",$db);
$query = mysql_query("select * from properties where id = '$id'", $db);
$row = mysql_fetch_array($query);
$location = $row['location']; $listing_type = $row['listing_type']; $price = $row['price']; $mls = $row['mls']; $prop_status = $row['prop_status']; $year_built = $row['year_built']; $sq_ft = $row['sq_ft']; $con_type = $row['con_type']; $beds = $row['beds']; $baths = $row['baths']; $fam_rm = $row['fam_rm']; $pantry = $row['pantry']; $heating = $row['heating']; $cooling = $row['cooling']; $garage = $row['garage']; $fenced_yd = $row['fenced_yd']; $hextra1 = $row['$hextra1']; $hextra2 = $row['$hextra2']; $hextra3 = $row['$hextra3']; $hextra4 = $row['$hextra4']; $hdescription = $row['hdescription']; $lot_size = $row['lot_size']; $acres = $row['acres']; $surveyed = $row['surveyed']; $land_split = $row['land_split']; $access = $row['access']; $bpublic = $row['bpublic']; $irrigated = $row['irrigated'];
$water_rights = $row['water_rights']; $land_water = $row['land_water']; $well = $row['well']; $power = $row['power']; $phone = $row['phone']; $septic = $row['septic']; $fenced = $row['fenced']; $landscaping = $row['landscaping']; $garden = $row['garden']; $livestock = $row['livestock']; $lextra1 = $row['$lextra1']; $lextra2 = $row['$lextra2']; $lextra3 = $row['$lextra3']; $lextra4 = $row['$lextra4']; $pic1 = $row['pic1']; $pic2 = $row['pic2']; $pic3 = $row['pic3']; $pic4 = $row['pic4']; $pic5 = $row['pic5']; $pic6 = $row['pic6'];
?>
Hope that's what you needed. 🙂