开发者

adding a user and selecting that user id from the DB in 1 query

What i would like to do is add a user to the DB. I have an id that auto-increments each time a user is added, but the problem is that i would like to get the id back from the user i just added and i would like to do it in 1 query. Anyone that ca开发者_高级运维n help me?


In PHP you do with mysql_insert_id()

mysql_query("INSERT INTO mytable (product) values ('kossu')");
printf("Last inserted record has id %d\n", mysql_insert_id());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜