开发者

how i can get inserted id by php and oracle

i know that its not first time someone ask this question, i look at questions in stakoverflow which covered same subject but they didnt give me what i need, my request is how can get inserted id by php and oracle i have table named USERS with 3 columns ID, USERNAME, PASSWORD so i neeed the inserted primary id

i know how make that by php + mysql

$insert = mysql_query("INSERT INTO USERS(USERNAME,PASSWORD)VALUES('{JOHN}','{1235}')"开发者_开发技巧);
if(!$insert){
die(mysql_error());
}
echo mysql_inserted_id();

please help me to do it in oracle i want do it with out use OCIBindByName


OCILogon is a synonym for oci_connect. Please read manual first before saying "I don't use this" ;)

http://php.net/manual/en/function.ocilogon.php

So the solution is here: Get the auto-generated ID after an insert

And I don't see why not to use OCIBindByName. There is nothing to love ;) Just use what's effective and easy.


Do you have think to use a Trigger "Before insert" on Oracle TABLE USERS and an Oracle Sequence to generate a unique number? Oracle Trigger Guide and Use of Oracle Sequences

I think this a possible solution.

Bye

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜