[ic] SQL insert with a form

Ed LaFrance interchange-users@interchange.redhat.com
Tue Nov 20 13:31:00 2001


At 09:40 AM 11/20/2001 -0800, you wrote:
>My database actually does an autoincrement on the Primary Key field, which 
>works
>fine when I use the
>[query sql="INSERT INTO Tkt SET customerName='[value customerName]',
>HelpDeskNum='[value HelpDeskNum]',serviceDate='[value serviceDate]',
>LocationWork='[value LocationWork]', AfterHours='[value AfterHours]'"]
>command.

Yep, but with form-based update, IC has to see valid data for the key value 
*in the form* or it will fail right off.


>I have tried adding the primary key in the "mv_data_fields":
>
><INPUT TYPE=HIDDEN NAME="mv_data_fields"
>VALUE="tktnum,customerName,HelpDeskNum,serviceDate,LocationWork,AfterHours,
>servicePerformed,host,domain">
>
>and having an input field with the tktnum, but I still get the error.
>
>Ticket Number: <INPUT NAME="tktnum" SIZE=30 >
>
>What I really want to do is escape out the sinqle quotes out of my test 
>before it
>gets written to the database, as the single quotes cause an SQL error. Any 
>ideas??

I'm not sure I understand that. You can use filters on form inputs and on 
'memory' values, so in either case it seems you should be able to condition 
the data as needed - read up on the [filter] tag and form-based filters.

If you want to use a form to directly write to the SQL table, use the 
[counter] tag to generate a unique key number, instead of the 
auto_increment field type.

- Ed L.




>Thanks,
>Dorothy
>
>Ed LaFrance wrote:
>
> > At 03:33 PM 11/19/2001 -0800, you wrote:
> > >I have gone over the mailing lists and the docs on how to insert into a
> > >table with a form. I have followed the instructions for UPDATING a
> > >database
> > >with a form at:
> > >http://interchange.redhat.com/cgi-bin/ic/docfly.html?mv_arg=ictemplates 
> 10%2e09,
> > >but I get an "Attempted database update without
> > >permission". Searching through the maillist, the answer to that question
> > >is to have mv_data_enable set to 1, which I do, and I still get nothing.
> > >Below
> > >is what I have in my form, can someone PLEASE help me.
> > >
> > >Thank you,
> > >Dorothy Puma
> > >
> > >[set mv_data_enable]1[/set]
> > ><FORM METHOD=POST ACTION="[process-target]">
> > ><INPUT TYPE=HIDDEN NAME="mv_nextpage" VALUE="serviceticket2-sent">
> > ><INPUT TYPE=HIDDEN NAME="mv_data_table" VALUE="Tkt">
> > ><INPUT TYPE=HIDDEN NAME="mv_data_key" VALUE="tktnum">
> > ><INPUT TYPE=HIDDEN NAME="mv_data_function" VALUE="insert">
> > ><INPUT TYPE=HIDDEN NAME="mv_data_fields"
> > >VALUE="customerName,HelpDeskNum,serviceDate,LocationWork,AfterHours,
> > >servicePerformed,host,domain">
> > ><INPUT TYPE=hidden NAME="mv_todo" VALUE="set">
> > >_______________________________________________
> >
> > FWIW - You are missing:
> >
> > <input type=your_choice name=tktnum value="a_key_id">
> >
> > - Ed L.
> >
> > ===============================================================
> > New Media E.M.S.               Software Solutions for Business
> > 463 Main St., Suite D          eCommerce | Consulting | Hosting
> > Placerville, CA  95667         edl@newmediaems.com
> > (530) 622-9421                http://www.newmediaems.com
> > (866) 519-4680 Toll-Free       (530) 622-9426 Fax
> > ===============================================================
> >
> > _______________________________________________
> > interchange-users mailing list
> > interchange-users@interchange.redhat.com
> > http://interchange.redhat.com/mailman/listinfo/interchange-users
>
>_______________________________________________
>interchange-users mailing list
>interchange-users@interchange.redhat.com
>http://interchange.redhat.com/mailman/listinfo/interchange-users

===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================