How to add the string before increment values with letters like A0001 increment to A0002---- please help me

Recommended Answers

All 2 Replies

I suggest you don't do this in the table, but just format the ID when you want to output it.

$incr = 0;
function my_increment()
    {
    global $incr;
    $my_string = "Bla-bla-bla";
    $my_increment = str_pad($incr, 4, "0", STR_PAD_LEFT); // how many digits you need (eg.4)
    $incr++ ;
    return $my_string.$my_increment;
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.