Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with an insert

Status
Not open for further replies.

prog247

Programmer
Mar 16, 2001
17
0
0
US
People i need some help.
How can i do an insert?
Please help.

Here's the source:

First Page:

<cfquery name = &quot;name&quot; datasource = &quot;datasource&quot; dbtype = &quot;dbtype&quot;>
SELECT
id,
description
FROM table
WHERE id = 0
ORDER BY description
</cfquery>


<form action = &quot;next_page.cfm&quot; method = &quot;post&quot;>

<cfoutput query = &quot;name&quot;>
<input type = &quot;checkbox&quot; name = &quot;selected_items&quot; value = &quot;#id#&quot;>#description#<br>
</cfoutput>

</form>




Next Page:


<cfquery name = &quot;sm_insert&quot; datasource = &quot;gene&quot; dbtype = &quot;odbc&quot;>
INSERT into table (row, id, row)
VALUES ('row', ?, 'row')
</cfquery>


Thanx.
 
Looking at your code, are you sure you are not wanting an UPDATE?

When you do an &quot;Insert&quot; the database will automatically add a new &quot;ID&quot; (assuming it is set to Autonumber or similiar). You will throw an error if you try to insert the &quot;autonumber&quot; field manually.

When you are inserting &quot;numbers&quot; or dates, you should not use the ' text delimiters.

A little more information on what you are trying to accomplish may help someone here do a better job in solving your problem.. error codes?..
 
My problem is i can't do an insert because the values of the checkboxes are pasing like this 1, 2, 3....
So how can i do an insert, or it's multiple insert?
Thanx
 
Please tell me exactly what you're trying to do.

I see the code, but that doesn't help if the code's wrong. Perhaps you want to use a form with checkboxes to insert IDs for only the checkboxes that are checked?

Checkout this thread of a few days ago: thread232-63706


My solution should atleast point you in the right direction. Let me know if I helped.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top