Is there a way to get last inserted id of a NON - auto incremented column in MySQL?

前端 未结 7 1363
别跟我提以往
别跟我提以往 2020-12-17 14:24

I know how LAST_INSERT_ID() works for auto incremented columns, but I cannot find a way to get the last id I inserted for a non auto incremented column.

Is there a

7条回答
  •  忘掉有多难
    2020-12-17 15:05

    This worked for me in XAMPP

    $qry = $con->query("INSERT INTO test_table(tbl_id, txt) VALUES(last_insert_id('15'), 'test value')");
    print_r($con->insert_id);
    

提交回复
热议问题