我如何通过php和oracle获取插入的id [英] how i can get inserted id by php and oracle
问题描述
我知道这不是第一次有人问这个问题,我看了stakoverflow中涉及相同主题的问题,但是他们没有给我我所需要的,我的要求是如何通过php和oracle插入id我有一个名为表的表用户具有3列ID,USERNAME和PASSWORD,因此我需要插入的主ID
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
我知道如何通过php + mysql
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();
请帮助我在oracle中完成它,我想不使用OCIBindByName来完成它
please help me to do it in oracle i want do it with out use OCIBindByName
推荐答案
OCILogon是oci_connect的同义词.在说我不使用此"之前,请先阅读手册;)
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
因此解决方案在这里: 在插入后获取自动生成的ID
So the solution is here: Get the auto-generated ID after an insert
我不明白为什么不使用OCIBindByName.没有什么可爱的;)只需使用有效且简单的方法即可.
And I don't see why not to use OCIBindByName. There is nothing to love ;) Just use what's effective and easy.
这篇关于我如何通过php和oracle获取插入的id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!