cf/dw error
|
|
Thread rating:  |
zac1234 - 24 Mar 2007 21:31 GMT This is really holding me up now. i posted the other for some help with some simple insert cf code. i still dont have this working and ive tried everythng there is to try. ive got a feeling that there is something wrong either with dw or cf server.
currently i am getting the following error message from within dw:
"while executing insepctserverbehanior in InsertRecord.htm, the following javascript error(s) occured:
At line 576 of file "C:\program file\macromedia\dreamweaver 8\configuration\servermodels\coldfusion\dwscriptsserverimpl.js typeerror: sqlVarRef has no properties"
i get this error message when i open up my new insert_new_admin_user.cfm page
so i have tried:
1, re writing the code several times 2, creating new table in the access db 3, repaired/install of dw 4, upgraded from cf server 6 to cf server 7 5, searched for help online
the strange thing is that other insert code works fine on pages that i created ages ago. its only the new ones that dont work. ive even tried coping the code from old pages and just changing the bits i need to but still doesnt work.
please see the other post for further details.
really need some help here. i wanted to have my site finised this weekend ...... but looks like it aint gunna happen :-(
zac
SafariTECH - 25 Mar 2007 17:41 GMT if you have changed the code so there is no SQL and still get this error, it sounds like CF is caching the page and not serving up the new page ... either that or it is not actually transferring the page to the server.
check in the Admin section and make sure it is not caching pages and or clear the cache
zac1234 - 25 Mar 2007 18:42 GMT thanks for getting back.
i tried what you said. the caching pages option is not selected in the cf admin area. i tried selecting it the restarting then deselecting and restarting just to see if that helped it. i also tried re doing the code with and without the sql but still not working.
this is the current cf code on the page:
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())> <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "new_admin_user"> <cfquery datasource="allieddatabase"> INSERT INTO admin_users_table1 (full_user_name, user_dept, user_id, user_pw, user_pw_confirm, level) VALUES ( <cfif IsDefined("FORM.full_user_name") AND #FORM.full_user_name# NEQ ""> '#FORM.full_user_name#' <cfelse> NULL </cfif> , <cfif IsDefined("FORM.user_dept") AND #FORM.user_dept# NEQ ""> '#FORM.user_dept#' <cfelse> NULL </cfif> , <cfif IsDefined("FORM.user_id") AND #FORM.user_id# NEQ ""> '#FORM.user_id#' <cfelse> NULL </cfif> , <cfif IsDefined("FORM.user_pw") AND #FORM.user_pw# NEQ ""> '#FORM.user_pw#' <cfelse> NULL </cfif> , <cfif IsDefined("FORM.user_pw_confirm") AND #FORM.user_pw_confirm# NEQ ""> '#FORM.user_pw_confirm#' <cfelse> NULL </cfif> , <cfif IsDefined("FORM.level") AND #FORM.level# NEQ ""> '#FORM.level#' <cfelse> NULL </cfif> ) </cfquery> <cflocation url="adminusers.cfm"> </cfif>
and this is the error message i get back:
Error Executing Database Query. Syntax error in INSERT INTO statement. The error occurred in F:\data\webdesigns\wwwroot\CFIDE\Allied\newadminuser.cfm: line 40
38 : <cfelse> 39 : NULL 40 : </cfif> 41 : ) 42 : </cfquery>
what do you make of this? any help would be so much appreciated
zac
Ian Skinner - 26 Mar 2007 15:14 GMT currently i am getting the following error message from within dw:
"while executing insepctserverbehanior in InsertRecord.htm, the following javascript error(s) occured:
Two thoughts:
This is a DW error and may not be impacting your actual functionality. DW itself uses quite a bit of JavaScript in it's wizards and such. Is your code not working when run on the server? If it does work you can ignore the DW error as annoying as it is.
There is a caching bug in DW itself. If you have the "Maintain synchronization information" option selected on the "Remote Info" section of the Site Definition it can cause problems. It prevents the file date-time stamp from changing when a file is uploaded so that CF does not realize a new version of the file is available and that it needs to recompile it. You can either turn off this option, or download and install the DW patch the fixes this bug.
zac1234 - 26 Mar 2007 20:49 GMT thanks for the info Ian. i did as you said and it has fixed the dw issue but my code still doesnt work :-( i have tried testing my code locally and i have uploaded to my web server but still no joy.
could you run your eyes over the code for my incase i'm missing something please?
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())> <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "new_admin_user"> <cfquery datasource="allieddatabase"> INSERT INTO admin_users_table1 (full_user_name, user_dept, user_id, user_pw, user_pw_confirm, level) VALUES ( <cfif IsDefined("FORM.full_user_name") AND #FORM.full_user_name# NEQ ""> '#FORM.full_user_name#' <cfelse> NULL </cfif> , <cfif IsDefined("FORM.user_dept") AND #FORM.user_dept# NEQ ""> '#FORM.user_dept#' <cfelse> NULL </cfif> , <cfif IsDefined("FORM.user_id") AND #FORM.user_id# NEQ ""> '#FORM.user_id#' <cfelse> NULL </cfif> , <cfif IsDefined("FORM.user_pw") AND #FORM.user_pw# NEQ ""> '#FORM.user_pw#' <cfelse> NULL </cfif> , <cfif IsDefined("FORM.user_pw_confirm") AND #FORM.user_pw_confirm# NEQ ""> '#FORM.user_pw_confirm#' <cfelse> NULL </cfif> , <cfif IsDefined("FORM.level") AND #FORM.level# NEQ ""> '#FORM.level#' <cfelse> NULL </cfif> ) </cfquery> <cflocation url="adminusers.cfm"> </cfif>
this code was generated by using the dw "insert record" wizard. i first creted my own code but that didnt wok either so i thought i'd try this.
any more thoughts? thanks for the help so far.
zac
Ian Skinner - 26 Mar 2007 20:57 GMT I don't see any obvious errors, other then the horrible formated "wizard" syntax witch in my mind is a sin.
What happens when your run your code? HOW does it not work? Error messages - provide us copies. Runs but produces incorrect results - what results, what was expected, what data was used?
> thanks for the info Ian. i did as you said and it has fixed the dw issue but my > code still doesnt work :-( i have tried testing my code locally and i have [quoted text clipped - 56 lines] > > zac zac1234 - 27 Mar 2007 19:50 GMT ok, thanks for getting back.
this is what the code looks like if i do it myself - i know what you are going to say first of all that the VALUES need to have # blabla# around them. if i wrap the VALUES in # then all i get is "new_admin_user.full_user_name is undefined in form"
if i take the # away the message i get is:
rror Executing Database Query. Syntax error in INSERT INTO statement. The error occurred in F:\data\webdesigns\wwwroot\CFIDE\Allied\newadminaction.cfm: line 1
1 : <cfquery name="add_new_admin" datasource="allieddatabase"> 2 : INSERT INTO admin_users_table (full_user_name, user_dept, user_id, user_pw, user_pw_confirm, level) 3 : VALUES ('new_admin_user.full_user_name', 'new_admin_user.user_dept', 'new_admin_user.user_id', 'new_admin_user.user_pw', 'new_admin_user.user_pw_confirm', 'new_admin_user.level' )
so what s right with or without the # ?
here is my html code:
<form method="POST" name="new_admin_user" action="newadminaction.cfm"> <label for="full_user_name">Name</label> <input type="text" name="full_user_name" id="full_user_name"> <label for="user_dept">Department</label> <select name="user_dept" id="app_select"> <option selected>OPS</option> <option>Sales</option> <option>Accounts</option> <option>P&W</option> <option>General management</option> </select> <label for="user_id">user name</label> <input type="text" name="user_id" id="use_id"> <label for="user_pw">Password</label> <input type="text" name="user_pw" id="user_pw"> <label for="user_pw_comfirm">Confirm Password</label> <input type="text" name="user_pw_confirm" id="user_pw_confirm"> <label for="level">Level</label> <select name="level" id="app_select"> <option>yes</option> <option>no</option> </select> <br> <input name="Submit" type="submit" id="submit_button" value="Submit"> </form>
its just supposed to be a simple insert into the db of the form contents. when i click on submit it should take me to the newadminuseraction.cfm page but instead it i get the error messages.
is this the info you needed?
Ian Skinner - 27 Mar 2007 20:05 GMT so what s right with or without the # ?
Yup, I can see your problem now.
With the hash/pound/# is required, but you are naming your variables wrong.
On your form page, the form is named "new_admin_user" and this can be used for javascript purposes at that time. But once the form is submitted to that action page, the data structure is named "form".
Your insert will need to look something like this: <cfquery name="add_new_admin" datasource="allieddatabase"> INSERT INTO admin_users_table (full_user_name, user_dept, user_id, user_pw, user_pw_confirm, level) VALUES ('#form.full_user_name#', '#form.user_dept#', '#form.user_id#', '#form.user_pw#', '#form.user_pw_confirm#', '#form.level#' ) </cfquery>
Of course an even better practice would be to wrap each of those variables in a proper <cfqueryParam ...> tag. Something like: VALUES (<cfqueryParam value="#form.full_user_name#" cfSqlType="cf_sql_varchar">, ... )
zac1234 - 27 Mar 2007 21:42 GMT yep thought you might say that, i meant to edit my post to say i had already tried that.
this is the error message i get from that:
Element FULL_USER_NAME is undefined in NEW_ADMIN_USER. The error occurred in F:\data\webdesigns\wwwroot\CFIDE\Allied\newadminaction.cfm: line 4
2 : INSERT INTO admin_users_table (full_user_name, user_dept, user_id, user_pw, user_pw_confirm, level) 3 : VALUES ( 4 : '#new_admin_user.full_user_name#', 5 : '#form.user_dept#', 6 : '#form.user_id#',
Ian Skinner - 28 Mar 2007 15:01 GMT Your error message is telling the entire story. You did not change 'new_admin_use' to 'form' on line four.
4 : '#new_admin_user.full_user_name#', SHOULD BE 4 : '#form.full_user_name#',
> yep thought you might say that, i meant to edit my post to say i had already > tried that. [quoted text clipped - 12 lines] > 5 : '#form.user_dept#', > 6 : '#form.user_id#', zac1234 - 28 Mar 2007 21:16 GMT yes i noticed that as soon as i posted so i corrected it and still got a simular error see last post.
have you got anymore ideas? i'm neally ready to top myself :-((
Ian Skinner - 28 Mar 2007 21:45 GMT > yes i noticed that as soon as i posted so i corrected it and still got a simular error see last post. > > have you got anymore ideas? i'm neally ready to top myself :-(( What exactly is the error you get.
zac1234 - 28 Mar 2007 22:04 GMT The error occurred in F:\data\webdesigns\wwwroot\CFIDE\Allied\newadminaction.cfm: line 9
7 : '#form.user_pw#', 8 : '#form.user_pw_confirm#', 9 : '#form.level#' ) 10 : </cfquery> 11 :
Ian Skinner - 28 Mar 2007 22:24 GMT What was the error? Undefined value?
If so, was an option selected on the form. IIRC if no option is selected then the variable does not exist on the form structure passed to the action page.
Adding this to the top of your action page can help see what is being passed and what is not.
<cfdump var="#form#">
zac1234 - 29 Mar 2007 08:19 GMT no the error was
Error Executing Database Query. Syntax error in INSERT INTO statement.
this is the result from the cf dump - interesting?
FIELDNAMES FULL_USER_NAME,USER_DEPT,USER_ID,USER_PW,USER_PW_CONFIRM,USER_LEVEL,SUBMIT FULL_USER_NAME [empty string] SUBMIT Submit USER_DEPT OPS USER_ID [empty string] USER_LEVEL yes USER_PW [empty string] USER_PW_CONFIRM [empty string]
Ian Skinner - 29 Mar 2007 14:53 GMT Error Executing Database Query. Syntax error in INSERT INTO statement.
Ok so now we need to look at your insert query. Do you see in the debug output. If you have full debugging turned on, it should be showing the processed SQL statement. Can you post that.
zac1234 - 29 Mar 2007 17:27 GMT is this what you mean?
Error Executing Database Query. Syntax error in INSERT INTO statement. The error occurred in F:\data\webdesigns\wwwroot\CFIDE\Allied\newadminaction.cfm: line 10
8 : '#form.user_pw#', 9 : '#form.user_pw_confirm#', 10 : '#form.user_level#') 11 : </cfquery> 12 :
SQL INSERT INTO admin_users_table1 (full_user_name, user_dept, user_id, user_pw, user_pw_confirm, level) VALUES ( '', 'OPS', '', '', '', 'yes') DATASOURCE allieddatabase VENDORERRORCODE 3092 SQLSTATE Resources:
* Check the ColdFusion documentation to verify that you are using the correct syntax. * Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3 Remote Address 10.0.0.201 Referrer http://allied-srv-03/CFS/newadminuser.cfm Date/Time 29-Mar-07 05:29 PM Stack Trace at cfnewadminaction2ecfm2080680316.runPage(F:\data\webdesigns\wwwroot\CFIDE\Allied\ newadminaction.cfm:10) at cfnewadminaction2ecfm2080680316.runPage(F:\data\webdesigns\wwwroot\CFIDE\Allied\ newadminaction.cfm:10)
com.inzoom.adojni.ComException: Syntax error in INSERT INTO statement. in Microsoft JET Database Engine code=3092 Type=1 at com.inzoom.ado.Command.jniExecute(Native Method) at com.inzoom.ado.Command.execute(Command.java:40) at com.inzoom.jdbcado.Statement.exec(Statement.java:34) at com.inzoom.jdbcado.Statement.execute(Statement.java:107) at coldfusion.server.j2ee.sql.JRunStatement.execute(JRunStatement.java:212) at coldfusion.sql.Executive.executeQuery(Executive.java:753) at coldfusion.sql.Executive.executeQuery(Executive.java:675) at coldfusion.sql.Executive.executeQuery(Executive.java:636) at coldfusion.sql.SqlImpl.execute(SqlImpl.java:236) at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:500) at cfnewadminaction2ecfm2080680316.runPage(F:\data\webdesigns\wwwroot\CFIDE\Allied\ newadminaction.cfm:10) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349) at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:225) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:51) at coldfusion.filter.PathFilter.invoke(PathFilter.java:86) at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:69) at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:52) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilt er.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:115) at coldfusion.CfmServlet.service(CfmServlet.java:107) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:78) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91) at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257) at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541) at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:204) at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:318) at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:426) at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:264) at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Ian Skinner - 29 Mar 2007 17:59 GMT INSERT INTO admin_users_table1 (full_user_name, user_dept, user_id, user_pw, user_pw_confirm, level) VALUES ( '', 'OPS', '', '', '', 'yes') DATASOURCE allieddatabase
Yup, this is the important part because it shows the SQL as it is actually sent to the database. I suspect the empty strings maybe causing the problem. There are a couple of ways one could handle this, my prefered method is the <cfqueryparam...> tag.
<cfquery name="add_new_admin" datasource="allieddatabase"> INSERT INTO admin_users_table (full_user_name, user_dept, user_id, user_pw, user_pw_confirm, level) VALUES (<cfqueryparam value='#form.full_user_name#' null='#NOT len(trim(form.full_user_name))#'>, <cfqueryparam value='#form.user_dept#' null='#NOT len(trim(form.user_dept))#'>, <cfqueryparam value='#form.user_id#' null='#NOT len(trim(form.user_id))#'>, <cfqueryparam value='#form.user_pw#' null='#NOT len(trim(form.user_pw))#'>, <cfqueryparam value='#form.user_pw_confirm#' null='#NOT len(trim(form.user_pw_confirm))#'>, <cfqueryparam value='#form.level# null='#NOT len(trim(form.level))#'>) </cfquery>
No guarantees on the typing and that there are not syntax errors.
What this does is if there is no value in the form field, then a null value is sent to the database instead of an empty string.
zac1234 - 29 Mar 2007 20:59 GMT ok, thou we had it then. only one typo! a # was missing, however still get the following error message :-(
thanks for sticking with this by the way, its really appreciated.
Error Executing Database Query. Syntax error in INSERT INTO statement. The error occurred in F:\data\webdesigns\wwwroot\CFIDE\Allied\newadminaction.cfm: line 15
13 : <cfqueryparam value='#form.user_pw_confirm#' null='#NOT 14 : len(trim(form.user_pw_confirm))#'>, 15 : <cfqueryparam value='#form.user_level#' null='#NOT len(trim(form.user_level))#'>) 16 : </cfquery> 17 :
SQL INSERT INTO admin_users_table (full_user_name, user_dept, user_id, user_pw, user_pw_confirm, level) VALUES ( (param 1) , (param 2) , (param 3) , (param 4) , (param 5) , (param 6) ) DATASOURCE allieddatabase VENDORERRORCODE 3092 SQLSTATE Resources:
* Check the ColdFusion documentation to verify that you are using the correct syntax. * Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3 Remote Address 10.0.0.201 Referrer http://allied-srv-03/CFS/newadminuser.cfm Date/Time 29-Mar-07 08:59 PM Stack Trace at cfnewadminaction2ecfm2080680316.runPage(F:\data\webdesigns\wwwroot\CFIDE\Allied\ newadminaction.cfm:15) at cfnewadminaction2ecfm2080680316.runPage(F:\data\webdesigns\wwwroot\CFIDE\Allied\ newadminaction.cfm:15)
com.inzoom.adojni.ComException: Syntax error in INSERT INTO statement. in Microsoft JET Database Engine code=3092 Type=1 at com.inzoom.ado.Command.jniExecute(Native Method) at com.inzoom.ado.Command.execute(Command.java:40) at com.inzoom.jdbcado.Statement.exec(Statement.java:34) at com.inzoom.jdbcado.PreparedStatement.execute(PreparedStatement.java:201) at coldfusion.server.j2ee.sql.JRunPreparedStatement.execute(JRunPreparedStatement.j ava:87) at coldfusion.sql.Executive.executeQuery(Executive.java:756) at coldfusion.sql.Executive.executeQuery(Executive.java:675) at coldfusion.sql.Executive.executeQuery(Executive.java:636) at coldfusion.sql.SqlImpl.execute(SqlImpl.java:236) at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:500) at cfnewadminaction2ecfm2080680316.runPage(F:\data\webdesigns\wwwroot\CFIDE\Allied\ newadminaction.cfm:15) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349) at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:225) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:51) at coldfusion.filter.PathFilter.invoke(PathFilter.java:86) at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:69) at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:52) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilt er.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:115) at coldfusion.CfmServlet.service(CfmServlet.java:107) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:78) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91) at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257) at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541) at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:204) at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:318) at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:426) at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:264) at jrunx.scheduler.WorkerThread.run(WorkerThread.java:6
SafariTECH - 29 Mar 2007 21:01 GMT INSERT INTO admin_users_table1 (full_user_name, user_dept, user_id, user_pw, user_pw_confirm, level) VALUES ( '', 'OPS', '', '', '', 'yes') DATASOURCE allieddatabase
----
One thing I notice is that the VALUES do not seem to synch up with the INSERT statement's field list.
In the above, the last item in the actual values is "YES" (user_pw_confirm?), when the INSERT indicates the last item should be a numeric value (level) ... this is why you are getting syntax errors ... because a numeric field cannot have a string assigned to it.
I would hazard to say that the values being assigned are out of whack due to the fact that some of the logic used in the filtering is throwing it off somewhere
zac1234 - 29 Mar 2007 21:17 GMT [q][i]Originally posted by: [b][b]SafariTECH[/b][/b][/i] INSERT INTO admin_users_table1 (full_user_name, user_dept, user_id, user_pw, user_pw_confirm, level) VALUES ( '', 'OPS', '', '', '', 'yes') DATASOURCE allieddatabase
----
One thing I notice is that the VALUES do not seem to synch up with the INSERT statement's field list.
In the above, the last item in the actual values is "YES" (user_pw_confirm?), when the INSERT indicates the last item should be a numeric value (level) ... this is why you are getting syntax errors ... because a numeric field cannot have a string assigned to it.
I would hazard to say that the values being assigned are out of whack due to the fact that some of the logic used in the filtering is throwing it off somewhere
Syntax errors are usually the result of type mismatches or missing punctuation more times than not.[/q]
interesting, when i use <cfdump var="#form#"> infront of the insert and read the whats being inputed they are in the worng order:
full_user_name,submit,user_dept,user_id,user_level,user_pw,user_pw_confirm <<<< this is not the order in which they are in on the form or the insert sql code. why is this?
also where does it say the user_level is numerical? as i have set this to text for the time being so as not to add to the confusion.
SafariTECH - 29 Mar 2007 21:24 GMT well, it may not actually be numerical, but that would be a good guess as to the syntax error and generally people use numeric values for "Level"
if all fields in the DB are actually text, then the above should not be throwing a syntax error for any reason since even the blanks are justified with empty strings.
if the error was due to the DB field not allowing nulls, the error would state that fact.
the only other thing I can think of , at least for you getting a "SYNTAX" error is that you use simply "level" in the INSERT command ... "LEVEL" could be a reserved word for your database ... try using "[level]" instead, or changing that field name... or is it supposed to be "user_level"?
as for the CFDUMP ... it will always show things out of order to the form, usually in alphabetical order ... that won't affect anything unless you are using it to feed the INSERT, which you are not. As long as the INSERT and VALUES sync, they can be in any order.
SafariTECH - 29 Mar 2007 21:26 GMT Also, can you verify please, that all fields in the DB are in fact CHAR fields?
If any fields are numeric or BIT fields and entries are out of sync, it could explain a few things.
zac1234 - 29 Mar 2007 21:36 GMT yes i can confimr that in the access db these are set to text (which i believe is varchar)
SafariTECH - 29 Mar 2007 21:30 GMT I just re-reviewed your initial coding.
Can you do me a favor, since you have been making changes here and there throughout this, could you post up a copy of the current code.
Thx
zac1234 - 29 Mar 2007 21:34 GMT ok here is the cf code from the action page:
<cfdump var="#form#"><cfquery name="add_new_admin" datasource="allieddatabase"> INSERT INTO admin_users_table (full_user_name, user_dept, user_id, user_pw, user_pw_confirm, level) VALUES (<cfqueryparam value='#form.full_user_name#' null='#NOT len(trim(form.full_user_name))#'>, <cfqueryparam value='#form.user_dept#' null='#NOT len(trim(form.user_dept))#'>, <cfqueryparam value='#form.user_id#' null='#NOT len(trim(form.user_id))#'>, <cfqueryparam value='#form.user_pw#' null='#NOT len(trim(form.user_pw))#'>, <cfqueryparam value='#form.user_pw_confirm#' null='#NOT len(trim(form.user_pw_confirm))#'>, <cfqueryparam value='#form.user_level#' null='#NOT len(trim(form.user_level))#'>) </cfquery>
and here is the html code from the form page: (if needed)
><form method="POST" name="new_admin_user" action="newadminaction.cfm"> <label for="full_user_name">Name</label> <input type="text" name="full_user_name" id="full_user_name"> <label for="user_dept">Department</label> <select name="user_dept" id="app_select"> <option selected>OPS</option> <option>Sales</option> <option>Accounts</option> <option>P&W</option> <option>General management</option> </select> <label for="user_id">user name</label> <input type="text" name="user_id" id="use_id"> <label for="user_pw">Password</label> <input type="text" name="user_pw" id="user_pw"> <label for="user_pw_comfirm">Confirm Password</label> <input type="text" name="user_pw_confirm" id="user_pw_confirm"> <label for="user_level">Level</label> <select name="user_level" id="app_select"> <option>yes</option> <option>no</option> </select> <br> <input name="Submit" type="submit" id="submit_button" value="Submit"> </form>
SafariTECH - 29 Mar 2007 21:47 GMT change the code in the INSERT from "level" to "[level]"
and then re-try submitting the form and see what happens.
zac1234 - 29 Mar 2007 22:01 GMT do you know what? i've had one of the worst days of my working life today..................... but you have just cheered me up no end!!!!
i changed level to user_level - i also noticed that since re-writing the code i had called the table user_admin_table instead of user_admin_table1 doh!
i have now sucsesfully inserted a new user! :-))))) thanks so much to you both for being so patient with me. hopefully one day i'll be able to return the favour to someone else on here.
thanks, take care.
zac
SafariTECH - 29 Mar 2007 22:15 GMT no problem ... we've all been there at one time or another :)
|
|
|