Akopia Akopia Services

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

Re: [mv] Updating Database Via Checkboxes



******    message to minivend-users from Bill Randle <billr@exgate.tek.com>     ******

Cameron,

It would seem to me you could create an SQL query to do this and invoke with the
[query] tag. Since your "printed" variable will have the list of items to
print, rather than the ones not to print, you;ll need to essentially negate the
test operation.

Here's an outline of where I'd start:
	[perl global=1]
	  my $dbname = 'yourdbname';
	  my @printers = split /'\0'/, $Values->{printed};
	  my $sql_req = "UPDATE $dbname SET to_print='no' WHERE (";
	  $sql_req .= join(' AND code != ', @printers);
	  $sql_req .= ")";
	  $sql_req =~ s/ AND /; # get rid of extra leading AND from join
	  $Scratch->{sql_req} = $sql_req;
	[/perl]

	[query sql="[scratch sql_req]"][/query]

	
"Cameron B. Prince" wrote:
> 
> ******    message to minivend-users from "Cameron B. Prince" <info@InternetExpertsLLC.com>     ******
> 
> Hi list,
> 
> I am using a sql query to display a loop of items in a database like this:
> 
> [search-region more=1 search="
>                 ra=yes
>         st=sql
>         sq=select * from invoices where to_print = 'yes'
>                 ml=999999
>                 tf=invoice_number
>                 "]
> 
> In the search list I have checkboxes for each result like this:
> 
> <input type="checkbox" NAME="printed" value="[item-data invoices code]">
> 
> So what this does is list all the invoices that are to be printed with checkboxes by each one.
> 
> What I need to do is create a form of some kind that will update the database and set to_print to 'no' for each checkbox that is checked.
> 
> I have had no problems updating Minivend databases when it comes to single items, but I am stumped as to how to do this multiple field update.
> 
> Can anyone provide any ideas?
> 
> Thanks,
> 
> Cameron
-
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: