[ic] [query] tag insert

Ed LaFrance edl at newmediaems.com
Mon Jan 12 11:57:39 EST 2004


At 10:37 AM 1/12/2004 -0600, you wrote:
>Is it possible to insert data into a table using the [query] tag?

Yes it is. Your problem is bad coding. You cannot use the [query] tag 
inside a [perl] block without the interpolate=1 parameter, and even then it 
is a bad idea. Use $Tag->query() or make direct calls to the dbi functions 
instead. Also, $Variable is preferable it $::Variable here; I'm not sure if 
the latter works at all in [perl].

- Ed


>I'm getting the error:
>Safe: Search pattern not terminated at (eval 193) line xxx
>
>I'm using interchange 4.8.6 and perl 5.8.0
>
>Here's a snip of my code:
>[set order_changes]
>[perl]
>
>my $sqldsn = $::Variable->{SQLDSN};
>my $sqluser = $::Variable->{SQLUSER};
>my $sqlpass = $::Variable->{SQLPASS};
>
># first we need to insert data into the order_changes_log table
>
>my $ordernumber = $CGI->{order};
>my $username = $Session->{username};
>my $comment = $Values->{comment};
>
>
>[query sql="insert into order_changes_log (order_number, username,
>timestamp, comment)
>values($CGI->{order}, $Session->{username}, now(), $Values->{comment})"]
>[/query]
>
>
>. more code going here .
>
>[/perl]
>[/set]
>
>Thanks,
>Eric Terry
>
>_______________________________________________
>interchange-users mailing list
>interchange-users at icdevgroup.org
>http://www.icdevgroup.org/mailman/listinfo/interchange-users

===============================================================
New Media E.M.S.              Technology Solutions for Business
11630 Fair Oaks Blvd., #250   eCommerce | Consulting | Hosting
Fair Oaks, CA  95628          edl at newmediaems.com
(916) 961-0446                http://www.newmediaems.com
(866) 519-4680 Toll-Free      (916) 961-0447 Fax
=============================================================== 



More information about the interchange-users mailing list