Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Auto increment

Post Reply
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Auto increment

Unread post 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?
BR
Rui
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Auto increment

Unread post by admin »

ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: Auto increment

Unread post by ruiascensao »

Hi Steven,

Thank you!

How can I use "#invoice_number#" inside "PHP Code"?
BR
Rui
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Auto increment

Unread post by admin »

Rui,

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

Steven
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: Auto increment

Unread post by ruiascensao »

Hi Steven,

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

Rui
BR
Rui
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Auto increment

Unread post by admin »

Tell all your friends!
Post Reply