fixed post (DATABASE HELP)
sorry about my original post messing up the layout. here it is again fixed
I am working on a new website for a realtor and I have set up a mysql database for his property listing. With each property, there are approx. 50 fields for each property.
After I scripted a basic insert form and tried to add a property, the query will not run properly. I was able to manually add an entry using phpmyadmin but I am curious as to why the online form will not work.
<?
$mls=$_POST['mls_id'];
$address=$_POST['address'];
$city=$_POST['city'];
$zip=$_POST['zip'];
$price=$_POST['price'];
$bdrms=$_POST['bedrooms'];
$baths=$_POST['bathrooms'];
$gsize=$_POST['garage_size'];
$gatta=$_POST['garage'];
$bsmnt=$_POST['bsmnt'];
$bsmnt_fin=$_POST['bsmnt_fin'];
$age=$_POST['age'];
$acres=$_POST['acres'];
$levels=$_POST['levels'];
$ele=$_POST['elementary'];
$mid=$_POST['middle'];
$hig=$_POST['high'];
$master=$_POST['master_bed'];
$bed1=$_POST['bed1'];
$bed2=$_POST['bed2'];
$liv=$_POST['living_room'];
$kit=$_POST['kitchen'];
$din=$_POST['dining_room'];
$yr=$_POST['yr_built'];
$lot=$_POST['lot_size'];
$legal=$_POST['legal'];
$fireplace=$_POST['fireplace'];
$range_oven=$_POST['range_oven'];
$frige=$_POST['refrigerator'];
$microwave=$_POST['microwave'];
$dishwasher=$_POST['dishwasher'];
$disposal=$_POST['disposal'];
$hood=$_POST['range_hood'];
$fence=$_POST['fence'];
$guttering=$_POST['guttering'];
$stormdoors=$_POST['storm_door'];
$heat=$_POST['heat'];
$assumable=$_POST['assum'];
$spec=$_POST['yr_spec'];
$assoc=$_POST['yr_assoc'];
$rent=$_POST['rent'];
$taxes=$_POST['taxes'];
$specs=$_POST['specs'];
$earnest=$_POST['earnest'];
mysql_connect('205.178.146.15',$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$add_prop = "INSERT INTO residential VALUES ('$mls','$address','$city','','$zip','$price','$bdrms','$baths','$gsize','$gatta','$bsmnt',
'$bsmnt_fin','$age','$acres','$levels','$ele','$mid','$hig','$master','$bed1','$bed2','$liv',
'$kit','$din','$yr','$lot','$legal','$fireplace','$range_oven','$frige','$microwave','$dishwasher',
'$disposal','$hood','$fence','$stormdoors','$guttering','$heat','$assumable','$spec','$assoc',
'$rent','$taxes','$specs','$earnest')";
mysql_query($add_prop) or die( "What the ****?");
mysql_close();
echo "Property added.";
?>
excluding the login credentials, that is the basic script I have. I am starting to think that I have the field types wrong for the database but I tried setting them all to VARCHAR thinking I would be able to add that way but still no luck.
If anyone could help advise me on setting this database up properly i would appreciate it. I have never had to work with so many fields for one table before and I am getting quite confused.
Thanks.
