:23 PM
Subject: Re: problem with insert
Assuming then that the variable for the cat_id is myCatID then you
are after this kind of thing:
cfset mylist=Advertising,tools
cfset myCatID = 1
cfloop list=#mylist# index=listItem
cfquery datasource=classifieds
INSERT INTO sub_categories
I know this is probably basic stuff, but I will ask anyway.
I have two tables
categories:
[id] pri key (This table is populated with the categories already)
category
sub_categories
[id] pri key
cat_id FK to categories.id (This table is empty)
sub_category
I want to insert a comma
NO!!! You don't!!! Create another table. You'll thank me later. Ask Jochem.
Ask Claude.
-Original Message-
From: Doug [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 05, 2006 9:26 AM
To: CF-Talk
Subject: problem with insert
I know this is probably basic stuff, but I will ask anyway
I cannot see why I would need another table. Can you explain a little
further?
- Original Message -
From: Dave Francis [EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Sent: Saturday, August 05, 2006 7:58 AM
Subject: RE: problem with insert
NO!!! You don't!!! Create another
Doug wrote:
I have two tables
categories: (This table is populated with the categories already)
[id] pri key
category
sub_categories (This table is empty)
[id] pri key
cat_id FK to categories.id
sub_category
I want to insert a comma delimeted list into the sub_categories
: Doug [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 05, 2006 9:26 AM
To: CF-Talk
Subject: problem with insert
I know this is probably basic stuff, but I will ask anyway.
I have two tables
categories:
[id] pri key (This table is populated with the categories already)
category
To: CF-Talk
Sent: Sat Aug 05 14:58:42 2006
Subject: RE: problem with insert
NO!!! You don't!!! Create another table. You'll thank me later. Ask Jochem.
Ask Claude.
-Original Message-
From: Doug [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 05, 2006 9:26 AM
To: CF-Talk
Subject: problem
to
convert it in the first place.
- Original Message -
From: Jochem van Dieten [EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Sent: Saturday, August 05, 2006 9:14 AM
Subject: Re: problem with insert
Doug wrote:
I have two tables
categories: (This table is populated
Subject: Re: problem with insert
ok I did this
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
cfset mylist=Advertising,tools
cfloop list=#mylist# index=listItem
cfquery datasource=classifieds
INSERT INTO sub_categories (sub_category,cat_id )
VALUES (cfqueryparam value=#myList
: problem with insert
Doug,
The order of the entries of fieldnames and values has to be the same.
So if you write:
INSERT INTO sub_categories (sub_category,cat_id )
The second value must be an integer.
Kevin
-Original Message-
From: Doug [mailto:[EMAIL PROTECTED]
Sent: 05
[EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Sent: Saturday, August 05, 2006 2:49 PM
Subject: RE: problem with insert
Doug,
The order of the entries of fieldnames and values has to be the same.
So if you write:
INSERT INTO sub_categories (sub_category,cat_id
I want to insert each item individually into the table.
- Original Message -
From: James Holmes [EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Sent: Saturday, August 05, 2006 6:34 PM
Subject: Re: problem with insert
No, from this:
cfloop list=#mylist# index=listItem
Message -
From: James Holmes [EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Sent: Saturday, August 05, 2006 8:41 PM
Subject: Re: problem with insert
For a given list of subcategories you want to insert, where is the
cat_id coming from?
--
CFAJAX docs and other useful articles
Joe's right, and you could really use one simple query to get it done like
cfquery DATASOURCE=#mydbname# NAME=UpdateData
UPDATE ImageData
SET PageViews = PageViews + 1,
ImageShowDate = GetDate()
WHERE ImageId = #ListRandImage#
/cfquery
The only disadvantage is that ImageShowDate overrides
Phillip,
It looks like you're inserting a new row into the table each time, in
which case it'd only go to two. What I think you mean to do is update
the row of the image returned by GetInfo3, in which case you'd want to
use an UPDATE statement. Try this:
cfquery datasource=applewood
I'm trying to update the pageviews + 1 every time a banner is shown on the
browser. But for some reason my code stopped at 2. It wont go any higher.
The first and second times the code updated correctly. It went from 1
pageview to 2 pageviews..now everything is 2 pageviews even though there are
at
,
ImageID,
ImageShowDate
)
VALUES
(
#Val(NewPageViews)#,
#ListRandImage#,
#createodbcdate(now())#
)
/cfquery
-Original Message-
From: Phillip Perry [mailto:[EMAIL PROTECTED]
Sent: Friday, October 22, 2004 5:52 PM
To: CF-Talk
Subject: Problem With Insert
I'm trying to update
Error Executing Database Query.
[MERANT][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft
Access Driver] Syntax error in INSERT INTO statement.
The error occurred in D:\websites\serviceorders.cfm: line 127
125 : insert into clntnote (thisdate,subject,note,type,compid)
126 : values
Subject: still having a problem with insert
Error Executing Database Query.
[MERANT][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC
Microsoft Access Driver] Syntax error in INSERT INTO statement.
The error occurred in D:\websites\serviceorders.cfm: line 127
125 : insert
are right, I am being selfish, but the last time I checked,
we don't have a whole lot of songs that feature the cowbell!
-Original Message-
From: Steven Sharko [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 25, 2004 8:38 AM
To: CF-Talk
Subject: still having a problem with insert
Steven, you may need to surrround some of your insert values with single quotes as it seems judging from variable names that they are strings.
- Original Message -
From: Steven Sharko
To: CF-Talk
Sent: Wednesday, February 25, 2004 9:37 AM
Subject: still having a problem with insert
like ppl keep saying the word type is a reserved word and WONT work
u will have 2 rename that field in your database, no ands, ifs or buts
about it.
read this, straight from the mothership
http://www.macromedia.com/support/ultradev/ts/documents/insert_into.htm
Error Executing Database Query.
- like the promise of mass rail transit.
-Mark
-Original Message-
From: Steven Sharko [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 25, 2004 8:38 AM
To: CF-Talk
Subject: still having a problem with insert
Error Executing Database Query.
[MERANT][SequeLink JDBC Driver][ODBC Socket
:00apos;}apos;,apos;Service Ticket 3173
- apos;,apos;brSubmitted by apos;,apos;tapos;,)
At 09:49 AM 2/25/2004, you wrote:
Subject: still having a problem with insert
Error Executing Database Query.
[MERANT][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC
Microsoft Access Driver
AM
To: CF-Talk
Subject: still having a problem with insert
Error Executing Database Query.
[MERANT][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft
Access Driver] Syntax error in INSERT INTO statement.
The error occurred in D:\websites\serviceorders.cfm: line 127
125 : insert
Yup, that's a mess alright. Looks like your form might be screwy as
well, or had some html in a field, or something. Check your form, fix
your text field values in the sql (wrap them with single quotes). And
once you've done that, don't use that SQL :P
Instead, use the cfqueryparam version that I
a problem with insert
I tried that and still got an error.
Error Executing Database Query.
[MERANT][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft
Access Driver] Syntax error in INSERT INTO statement.
The error occurred in D:\websites\netpacq\serviceorders.cfm: line 127
125
A trick I used in the my youth to help me learn:
Since you are using Access, use the query builder in Access to build the query, then change the view to SQL view and copy the SQL code from there and paste into your Cold Fusion cfquery... tag.A few simple modifications to incorporate the form
From: [EMAIL PROTECTED]
like ppl keep saying the word type is a reserved word and
WONT work u will have 2 rename that field in your database,
no ands, ifs or buts about it.
read this, straight from the mothership
http://www.macromedia.com/support/ultradev/ts/documents/insert
_into.htm
: Re: problem with insert
Even crazier.I just typed this out to check and just parsed it
in
query analyzer and get an error. WTF
Line 2: Incorrect syntax near '123456789'.
INSERT INTO customer
VALUES '123456789'
Doug
- Original Message -
From: Douglas L. Brown [EMAIL PROTECTED
]
Sent: Saturday, November 17, 2001 11:31 PM
Subject: Re: RESOLVED:: problem with insert
Doh!
We learn from our mistakes don't we? heh heh!
It can also be database specific, Oracle / SQL Server / MS SQL can all
differ
in syntax if not in logic.
Quoting Douglas L. Brown [EMAIL PROTECTED
I have the following query and keep getting an error upon insert. The
field type is varchar(10) and the one giving an error is custNum
Error = Error Diagnostic Information
ODBC Error Code = 37000 (Syntax error or access violation)
[Microsoft][ODBC SQL Server Driver][SQL
Looks like you are trying to insert numeric data as text into a number only
field. You are using 'quotes' somewhere you shouldn't be.
Quoting Douglas L. Brown [EMAIL PROTECTED]:
I have the following query and keep getting an error upon insert. The
field type is varchar(10) and the one
, 2001 4:14 PM
Subject: Re: problem with insert
Looks like you are trying to insert numeric data as text into a number
only
field. You are using 'quotes' somewhere you shouldn't be.
Quoting Douglas L. Brown [EMAIL PROTECTED]:
I have the following query and keep getting an error upon insert
PROTECTED]
Sent: Saturday, November 17, 2001 4:36 PM
Subject: Re: problem with insert
The only numeric fields are ID, ZIP_CODE. That is why I cannot figure it
out. I have an update that is the sam and works fine on the same table and
the same columns. Here is the update.
UPDATE
Didnt have () around my values to insert.
Doug
- Original Message -
From: Douglas L. Brown [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Saturday, November 17, 2001 4:36 PM
Subject: Re: problem with insert
The only numeric fields are ID, ZIP_CODE. That is why
Doh!
We learn from our mistakes don't we? heh heh!
It can also be database specific, Oracle / SQL Server / MS SQL can all differ
in syntax if not in logic.
Quoting Douglas L. Brown [EMAIL PROTECTED]:
Didnt have () around my values to insert.
Doug
that wont work - db would look for a field with the generated UUID as a
name... you need to have a subselect:
[snip]
SELECT (select '#CreateUUID()#') as MyUUID, name, VersionID + 1
nope, you don't need a "subselect". in fact for some DBs (say sql server)
you don't even need to have the
to change, but this can be done by +1
it seems, thank you)
From: Daniel Lancelot [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Subject: RE: Problem with Insert Using Select
Date: Fri, 09 Feb 2001 14:50:00 -
that wont work - db would look for a field
to change, but this can be done by +1
it seems, thank you)
From: Daniel Lancelot [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Subject: RE: Problem with Insert Using Select
Date: Fri, 09 Feb 2001 14:50:00 -
that wont work - db would look for a field
Message-
From: andrew kopelman [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 08, 2001 11:00 PM
To: CF-Talk
Subject: Problem with Insert Using Select
I want to insert new records into a table which has MyUUID as its primary
key as well as a column, VersionId, which needs to be updated
-Original Message-
From: Bob Silverberg [mailto:[EMAIL PROTECTED]]
Sent: 09 February 2001 05:49
To: CF-Talk
Subject: RE: Problem with Insert Using Select
You answered your own question in your last paragraph - you _can_ put
constants and expressions in your select statement.
Try something like
I want to insert new records into a table which has MyUUID as its primary
key as well as a column, VersionId, which needs to be updated. Each new
record should be identical to the old record, except for a new MyUUID and an
incremented VersionID. For example, this old record:
MyUUID:
43 matches
Mail list logo