auto-increment code in Phalcon

there any way to do auto-increment code Phalcon or performed in the conventional way



67.7k

if noone replies, can you explain me what auto-increment code is



12.2k
edited Nov '15

$i = $i + 1; ? or $new_id = $last_id ++; ? If you are working with a MySQL database then you will setup the field e.g. user_id to auto increment. If you need to do it for something else in your code, then just use plain php as above. I do not think there is a specific function in Phalcon to do this.



67.7k
edited Nov '15

++$new_id; ?

what do you need it for, i dont see a point of a function in any case i can imagine


function increament(&$i){
    ++$i;
}

pfff.. sorry. Tought you were the guy who asked the question. Sorry



12.2k

ha ha my icon's a slightly different shade of green! :)



36.3k

I want to autoincrementable a field from the database, a primary code example:

CODE-001 CODE-002 CODE-003 CODE-004