Get the generated uuid after insert php

前端 未结 4 1679
一生所求
一生所求 2020-12-09 12:33

i have a table field type varchar(36) and i want to generate it dynamically by mysql so i used this code:

$sql_code = \'insert into table1 (id, text) values          


        
4条回答
  •  有刺的猬
    2020-12-09 13:18

    Its pretty easy actually you can pass this to mysql and it will return the inserted id.

    set @id=UUID();
    insert into (,) values (@id,'another value');
    select @id;
    
        

    提交回复
    热议问题