Hi paul, thanks I will add this as well:) John On Dec 31, 2008, at 4:44 AM, Paul Kukiel wrote:
> Also all the values especially from the form should be using > <cfqueryparam > /> > > > > Paul <http://blog.kukiel.net/> > > > > -----Original Message----- > From: Dave Phillips [mailto:[email protected]] > Sent: Wednesday, 31 December 2008 8:13 AM > To: cf-newbie > Subject: RE: write html links to db with form > > > > John, > > > > You don't have the same number of values specified in your INSERT > statement > > as you do columns. There needs to be an exact match. If you > specify 7 > > columns, then you need to have a value for each one. This is why your > > insert statement is failing. > > > > <cfquery datasource="#REQUEST.dataSource#"> > > INSERT INTO > > daily_tip_copy > (tipdate,tiptopic,dailytip,consumer_text,consumer_link,researc > > h_text,research_link) > > VALUES(<cfqueryparam > > cfsqltype="CF_SQL_DATE" > > value="#CreateODBCDate(FORM.tipdate)#">, '#FORM.tiptopic#', > > > > '#FORM.dailytip#', > > '<a > > href="#FORM.consumer_link#">#FORM.consumer_text#</a>' > > '<a > > href="#FORM.research_link#">#FORM.research_text#</a>') > > > > </cfquery> > > > > Should be: > > > > <cfquery datasource="#REQUEST.dataSource#"> > > INSERT INTO > > daily_tip_copy > (tipdate,tiptopic,dailytip,consumer_text,consumer_link,researc > > h_text,research_link) > > VALUES(<cfqueryparam > > cfsqltype="CF_SQL_DATE" > > value="#CreateODBCDate(FORM.tipdate)#">, > > '#FORM.tiptopic#', > > '#FORM.dailytip#', > > '#FORM.consumer_text#', > > '#FORM.consumer_link#', > > '#FORM.research_text#', > > '#FORM.research_link#') > > > > </cfquery> > > > > Now you are storing your 'text' and 'link' separately in the > database. When > > you display this data elsewhere as a link, that's when you might do > > something like this: > > > > <cfquery datasource="#request.datasource#" name="qGetLinks"> > > Select consumer_text, consumer_link, research_text, research_link > > From daily_tip_copy > > </cfquery> > > > > <cfoutput query="qGetLinks"> > > <a > > href="#qGetLinks.consumer_link#">#qGetLinks.consumer_text#</a><br> > > <a > > href="#qGetLinks.research_link#">#qGetLinks.research-text#</a><br> > > </cfoutput> > > > > There is no need to store the actual HTML in your database since it > would be > > the same for every link. > > > > HTH, > > > > Dave > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4255 Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
