Page 1 of 1

Auto increment

Posted: Mon Aug 25, 2014 1:23 am
by ruiascensao
Hi,
I'm trying to use the below code to auto increment a field. I added the hash variables for nuBuilderPro but it does not work.

Code: Select all

if('#nu_cloned_record#' == '1' or '#RECORD_ID#' == '-1'){     //-- this is a new record

   nuRunQuery("INSERT INTO recepcounter (extra_field) VALUES ('1')");

   $s  = "UPDATE reception SET reception_code = '" . mysql_insert_id() . "' ";
   $s .= "WHERE reception_id = '#nu_new_record#'";

   nuRunQuery($s);

}
Could you please advise?

Re: Auto increment

Posted: Wed Aug 27, 2014 6:18 am
by admin

Re: Auto increment

Posted: Wed Aug 27, 2014 11:54 pm
by ruiascensao
Hi Steven,

Thank you!

How can I use "#invoice_number#" inside "PHP Code"?

Re: Auto increment

Posted: Thu Aug 28, 2014 3:19 am
by admin
Rui,

You can use nuNextNumber($t)... (http://wiki.nubuilder.net/index.php/PHP ... .28.24t.29)

Steven

Re: Auto increment

Posted: Thu Aug 28, 2014 3:40 pm
by ruiascensao
Hi Steven,

Thanks!
Sorry ... I'm just starting with nuBuilder3.
Great product.

Rui

Re: Auto increment

Posted: Mon Sep 01, 2014 1:28 am
by admin
Tell all your friends!