The error not with your arguments. It is on this line:
<cfdump var=#insert("gk","ad","fo","ew",32444,43,"male")#/>
The insert function takes only three parameters.
insert(substring,string,position)
On Tue, Nov 23, 2010 at 12:08 AM, mojtaba tabatabaie
<[email protected]> wrote:
>
> hi , I'm writing a code to insert some values to my database , and there are
> 7 of them . but when I run it , CF tells me that the function takes 3
> parameters .the code is really simple and I don't get what's wrong . so
> anyone has any experience with this , I'll be appriciated if you can help.
> here's my code :
>
> <cfcomponent>
> <cfprocessingdirective pageencoding="utf-8">
> <cfset setEncoding("form","utf-8")>
> <cfset setEncoding("url","utf-8")>
> <cfcontent type="text/html ; charset=UTF-8">
>
> <cffunction name="insert" access="remote" returntype="void">
> <cfargument name="username" type="string"
> required="true">
> <cfargument name="password" type="string"
> required="true">
> <cfargument name="fname" type="string" required="true">
> <cfargument name="lname" type="string" required="true">
> <cfargument name="ncard" type="numeric"
> required="true">
> <cfargument name="age" type="numeric" required="true">
> <cfargument name="sex" type="string" required="true">
> <cfquery name="qInsert" datasource="Library">
> insert into
> Users(username,password,fname,lname,nationalCard,age,sex)
> values(<cfqueryparam value=#username#
> cfsqltype="cf_sql_varchar">,<cfqueryparam value=#password#
> cfsqltype="cf_sql_varchar">,<cfqueryparam value=#fname#
> cfsqltype="cf_sql_varchar">,<cfqueryparam value=#lname#
> cfsqltype="cf_sql_varchar">,<cfqueryparam value=#ncard#
> cfsqltype="cf_sql_numeric">,<cfqueryparam value=#age#
> cfsqltype="cf_sql_numeric">,<cfqueryparam value=#sex#
> cfsqltype="cf_sql_varchar">)
> </cfquery>
> </cffunction>
>
> <cfdump var=#insert("gk","ad","fo","ew",32444,43,"male")#/>
> </cfcontent>
> </cfcomponent>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:339448
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm