• Resolved bertelu

    (@bertelu)


    Hi Folks, sorry i’m new on WP. i saw the solution for incrementing a fied (Serial Number or Auto increment number field | www.remarpro.com) and i was implementing it succesfully, however i can’t figure out how can i set a starrting value other than 1. i need to start incrementing from a given value (i.e. 1254) and from there start incrementing. let say that i need to set an initial value of the variable when that variable is initialized for the first time

    thanks for any help

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @bertelu

    I hope you are doing well.

    Based on that code it verifies if the incremental doesn’t exist yet it sets 1

    if ( ! $incremental ) {
    		$incremental = YOUR_NUMBER;
    	} else {
    		$incremental++;
    }

    In this case, you should be able to replace 1 using any number.

    Let us know if that was what you were looking for.
    Best Regards
    Patrick Freitas

    Thread Starter bertelu

    (@bertelu)

    Thanks Patrick, i realized your solution rigth after submitting the topic. but now that my fariable has been already set (for the testing purpose) there is a way to change the current value? let say that now the variable contain the number “123” but now that i’m putting the site in production, i need to start from another value. how can i re-initialize the variable now that is already existing?

    Plugin Support Dmytro – WPMU DEV Support

    (@wpmudevsupport16)

    Hello @bertelu,

    You can temporarily replace this part:

    if ( ! $incremental ) {
    		$incremental = YOUR_NUMBER;
    	} else {
    		$incremental++;
    }

    with:

    $incremental = YOUR_NUMBER;

    – change this to your desired current number, for example:

    $incremental = 0;

    Submit the form one time to reset the value. After submitting the form change the code back.

    Hope this helps. Let us know if you have any questions.

    Best Regards,
    Dmytro

    Plugin Support Dmytro – WPMU DEV Support

    (@wpmudevsupport16)

    Hello @bertelu,

    We haven’t heard from you for a while, so I’m going to mark this thread as resolved.

    Feel free to re-open it, in case you need any further help resolving the issue.

    Best Regards,
    Dmytro

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘autoincrement’ is closed to new replies.