Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
quote:
Originally posted by: jdeline
I presume remoteHost is a text field that is long enough to hold the full path. Could you <CFOUTPUT> CGI.REMOTE_HOST and post it?
Copy link to clipboard
Copied
quote:
Originally posted by: zac1234
i have a hidden field on my contact form and i want to collect the date that the user submits the form.
my hidden field: <input name="date" type="hidden" id="date" value="<cfoutput>>#DateFormat(Now())#</cfoutput>">
then my inserting code:
<cftransaction>
<CFQUERY NAME="insertRecord" DATASOURCE="weblordatabase">
INSERT INTO contactformtable1 (firstname, lastname, company, email,
telephone, fax, service, comments, remoteHost, date, submit)
VALUES
('#firstname#', '#lastname#', '#company#', '#email#',
'#telephone#', '#fax#', '#service#', '#comments#', '#CGI.REMOTE_HOST#', '#date#', '#submit#')
</CFQUERY>
what am i doing wrong? i just keep getting the follwoing eror code:
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
The error occurred in D:\Domains\weblor.com\wwwroot\insert.cfm: line 9
7 : VALUES
8 : ('#firstname#', '#lastname#', '#company#', '#email#',
9 : '#telephone#', '#fax#', '#service#', '#comments#', '#CGI.REMOTE_HOST#', '#date#', '#submit#')
10 : </CFQUERY>
11 : <cfquery name="GetRecord" datasource="weblordatabase">
all help will be much appriciated
Copy link to clipboard
Copied
Copy link to clipboard
Copied
quote:
Originally posted by: BKBK
- If the date column has datetime datatype, as one would expect, you will get an error if you attempt to insert '#date#'. Correct is #date#, without the single-quotes;
- For the variable you now call date, I would use the name theDate instead. It saves you from worrying about database-forbidden names;
- Since the date value you wish to store is "now", it makes the date-insert pretty straightforward. You don't need to format the form input. Just insert the value #now()# or #createodbcdatetime(now())#. (This assumes, of course, that the datatype is datetime.)
Copy link to clipboard
Copied
quote:
The first thing you are doing wrong is using a cold fusion function to get the current date and time instead of your database. While using cold fusion's now() function will work, using your db's equivalent is more efficient.
The next thing is using dateformat without a mask.
The next thing is using dateformat instead of one of the two functions that start with createodbc.
Copy link to clipboard
Copied
quote:
Originally posted by: zac1234
quote:
The first thing you are doing wrong is using a cold fusion function to get the current date and time instead of your database. While using cold fusion's now() function will work, using your db's equivalent is more efficient.
The next thing is using dateformat without a mask.
The next thing is using dateformat instead of one of the two functions that start with createodbc.
ok thanks for the advise but could you give me some more info, please remember that i am totally new to coding and i ned things spelling out for me.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied