Quantcast
Channel: Adobe Community : All Content - ColdFusion
Viewing all articles
Browse latest Browse all 5979

CSV into MYSQL database

$
0
0

I am attempting to take a lot of data from a csv file and import it into a mysql database.

 

My Code

<cffile action="read"file="http://website.com/testtmk.csv" variable="datacsv">

 

<cfloop index="index" list="#datacsv#" delimiters="#chr(10)##chr(13)#">

<cfquery datasource="X" username="Y" password="Z!" name="putproperty">

 

 

INSERT INTO property

   (Property_id, Amenities, Association, Association_Fee, Association_includes, Bath_full, Baths_half, Beds, Building, City, Easement, FloodZone,

   Floor, Flooring, Furnished, Inclusion, Tenure, ListPrice, ListSvc, LotFeature, LotSize, Maintenance, MLSID, Neighbourhood, Parking, ParkingTotal,

   Permitaddress, PotoCount, PoolFeatures, Postal, PropertyCondition, PropertyType, PublicRemarks, Restrictions, SQFTBuilding`, SQFTGarage`, SQFTLanai,

   SQFTRoof, SQFTRoofO, SQFTTotal, State, Status, Stories, StreetName, StreetNumber, StreetSuff, UnitFeatures, UnitNumber, Utilities, View,

   VirtualTour, YearRemodeled)

  

VALUES

   ('#Amenities#',

   '#form.Association#', '#form.Association_Fee#', '#form.Association_includes#', '#form.Bath_full#', '#form.Baths_half#', '#form.Beds#', '#form.Building#', '#form.City#', '#form.Easement#', '#form.FloodZone#',

   '#form.Floor#', '#form.Flooring#', '#form.Furnished#', '#form.Inclusion#', '#form.Tenure#', '#form.ListPrice#', '#form.ListSvc#', '#form.LotFeature#', '#form.LotSize#', '#form.Maintenance#', '#form.MLSID#', '#form.Neighbourhood#', '#form.Parking#', '#form.ParkingTotal#',

   '#form.Permitaddress#', '#form.PotoCount#', '#form.PoolFeatures#', '#form.Postal#', '#form.PropertyCondition#', '#form.PropertyType#', '#form.PublicRemarks#', '#form.Restrictions#', '#form.SQFTBuilding#', '#form.SQFTGarage#', '#form.SQFTLanai#',

   '#form.SQFTRoof#', '#form.SQFTRoofO#', '#form.SQFTTotal#', '#form.State#', '#form.Status#', '#form.Stories#', '#form.StreetName#', '#form.StreetNumber#', '#form.StreetSuff#', '#form.UnitFeatures#', '#form.UnitNumber#', '#form.Utilities#', '#form.View#',

   '#form.VirtualTour#', '#form.YearRemodeled#')

 

 

</cfquery>

 

 

</cfloop>

 

 

<strong><cfquery datasource="X" username="Y" password="Z!" name="getproperty">

SELECT * FROM Property

</cfquery>

<cfdump var="#getproperty#">

 

My Error Code

Variable AMENITIES is undefined.

The error occurred in D:/home/manpcs.com/wwwroot/Untitled_cfm.cfm: line 17
15 : 16 :  VALUES 17 : ('#Amenities#',  18 :    '#form.Association#', '#form.Association_Fee#', '#form.Association_includes#', '#form.Bath_full#', '#form.Baths_half#', '#form.Beds#', '#form.Building#', '#form.City#', '#form.Easement#', '#form.FloodZone#', 19 :    '#form.Floor#', '#form.Flooring#', '#form.Furnished#', '#form.Inclusion#', '#form.Tenure#', '#form.ListPrice#', '#form.ListSvc#', '#form.LotFeature#', '#form.LotSize#', '#form.Maintenance#', '#form.MLSID#', '#form.Neighbourhood#', '#form.Parking#', '#form.ParkingTotal#', 

 

My Question.

How do I designate the Values of each column and row to be specific?

 

Thank you for your help in advance


Viewing all articles
Browse latest Browse all 5979

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>