Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] Conditional comparison of the value of two variables



******    message to minivend-users from Hans-Joachim Leidinger <jojo@buchonline.net>     ******

"Swisher, Karl" schrieb:
> 
> ******    message to minivend-users from kswisher@iolinc.net (Swisher, Karl)     ******
> 
> Hello,
>         I've been working over 3 days on about one line of code. The docs and
> archieve list provided what seemed to be everything needed but it still doesn't
> work.
>         What I'm trying to do is simply compare 2 variables for equality.  The
> variables are set with a form on the perviouse page and passed to the next
> page with [tag flag build].  These variables are passed correctly and verified
> with [value pass_var1] and [value pass_var2] being printed on the next page
> where the comparison is made. Also the sql statement properly updates the
> database when a true condition is returned.
> 
>         Any help will be appreciated.
> 
>         I'm using RH 6.1,  perl 5.00503 and  Minivend 3.14.
> 
> Thanks
> Karl
> 
>  Here are only some of the examples I've tried.
> --------------------------------------------------
> [perl]
>          $tmpvar1 = $Safe{'values'}->'{pass_var1}';
>          $tmpvar2 = $Safe{'values'}->'{pass_var2}';
>          if ('222222' eq '222222') {
>                 [sql type=set interpolate=1]
>                         update recotable_tbl set var1=[value pass_var1] where trim(recoid) ='[value pass_recoid]'
>                 [/sql]
>                 return "Update was successful";
>         } else {
>                 return "Update was not successful";
>            }
> [/perl]

How about

[set name="var1" interpolate=1][value pass_var1][/set]
[set name="var2" interpolate=1][value pass_var2][/set]

[perl arg=scratch]
          $a = $Safe{'scratch'}->'{var1}';
          $b = $Safe{'scratch'}->'{var2}';
          if ($a eq $b) {
                 [sql type=set interpolate=1]
                         update recotable_tbl set var1=[scratch var1]
where trim(recoid) ='[value pass_recoid]'
                 [/sql]
                 return "Update was successful";
         } else {
                 return "Update was not successful";
            }

[/perl]

(not tested)?
What did your error.log saying?

Regards,

	Joachim


-- 
-------------Hans-Joachim Leidinger---------------------


-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: