Hi Paul, Thanks so much for getting back to me. yes, I am sure about the database field being there, This has drove me crazy today. The original tutorial is from easy cfm: http://tutorial45.easycfm.com/
They used fname instead of first_name. Everything else is the same. Thanks again for your help, John On Jul 10, 2008, at 7:17 PM, Paul Kukiel wrote: > Hi John, > > Are you sure the fist_name column exists in the database? > > <cfquery name="q" datasource="#REQUEST.dataSource#"> > Select * > From tutorials > </cfquery> > > <cfdump var="#q#" /> > > And check if there column names are correct. > > Are you able to link the tutorial you are working from and I can > try the > same code. > > Paul > > > -----Original Message----- > From: John Barrett [mailto:[EMAIL PROTECTED] > Sent: Friday, 11 July 2008 2:31 PM > To: CF-Newbie > Subject: CF & MySQL Troubles > > Hi, > I am trying to get a tutorial working with CF & MySQL, I went over > and over > everything, and it seems like everything is fine, but I always get the > error: > Unknown column 'first_name' in 'field list' > > I read that MySQL needs the "'" in the VALUES clause, and I have > that. I am > wondering if anybody can help out with this one, This is a MySQL > error,a dn > not ColdFusion, right? Also, how can I avoid this issue in the future? > > Thanks so much, > John > > <!---add.cfm---> > <cfform action="actionpage.cfm" method="post"> > <table width="400" border="1" align="center"> > <tr align="center"> > <td colspan="2">Add Yourself To Our Mailing List</td> > </tr> > <tr> > <td width="191" align="right">First Name: </td> > <td width="193"><cfinput type="text" name="first_name" > id="first_name"></td> > </tr> > <tr> > <td align="right">Last Name: </td> > <td><cfinput type="text" name="last_name" id="last_name"></td> > </tr> > <tr> > <td align="right">Email Address: </td> > <td><cfinput type="text" name="email" id="email"></td> > </tr> > <tr align="center"> > <td colspan="2"><cfinput type="submit" name="Submit" > value="Add Me to > Mailing List"></td> > </tr> > </table> > </cfform> > > <!---actionpage---> > <!--- Query's Where statement is Checking to see > if the email address already exists in the database ---> > <cfquery name="DupCheck" datasource="#REQUEST.dataSource#"> > SELECT email > FROM tutorials > WHERE email = '#Form.email#' > </cfquery> > > <!--- If our query shows a email match than using > recordCount we can tell the user that his email > address already exists in our database ---> > <cfif DupCheck.recordCount GT "0"> > You are already Listed in our Mailing List! > <!--- If our recordCount is not greater than "0" > we continue on and process the new email address ---> > <cfelse> > > <cfquery name="DupCheck" datasource="#REQUEST.dataSource#"> > INSERT INTO tutorials (first_name,last_name,email) > VALUES ('#Form.first_name#','#Form.last_name#', '#Form.email#') > > </cfquery> > > <html> > <head> > <title>Tell User he is now in the Database</title> > <meta http-equiv="Content-Type" content="text/html; > charset=iso-8859-1"> > </head> > <body> > > <cfoutput> > Thank You #Form.first_name# #Form.last_name# your email address: > #Form.email# has now been entered into our database! > </cfoutput> > > </body> > </html> > > </cfif> > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3809 Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
