[ic] aborting a form insert if record already exists

Stefan Hornburg Racke interchange-users@icdevgroup.org
Thu Jul 18 04:23:01 2002


Brent Kelly <brent@zeald.com> writes:

> Hi all,
> 
> I'm a little stumped at present on trying to abort a 'form-based' insert if 
> certain conditions exist?
> 
> i.e. if i use a form to insert a new record to a table using mv_data_table, 
> mv_data_key etc with mv_data_function set to insert, it appears to be 
> performing an update if the record already exists, and overwriting the 
> existing data. 
> 
> Obviously this is not good & so I want to check that the record doesn't 
> already exist, and if it does, abort the insert & display an error message??
> 
> Is it possible to do this thru a mv_click or any other way?

Try that:

[set myclick]
[loop list="[cgi sku]"]
[if data products::sku::[loop-code]]
mv_todo=go
mv_nextpage=dont_update_product
[/if]
[/loop]
[/set]

Ciao
        Racke

-- 
Prolific Interchange Consulting (Excellent German Quality !).
Take a look at Materialboerse (http://www.materialboerse.de/), WITT 
(http://www.witt-weiden.de/), Boxmover (http://shop.boxmover.ch/) or 
Passionshop (http://www.passionshop.com/racke). Need a shop ? Contact us.