如何修复oci_execute():ORA-00957:重复的列名...?

时间:2018-12-29 19:29:48

标签: php sql database oracle oracle11g

我正在尝试将表单值数据插入Oracle数据库,但是出现此错误...请帮助...?

if(isset($_POST['submit'])){

  $id = $_POST['id'];
  $username = $_POST['username'];
  $password = $_POST['password'];
  $nameen = $_POST['nameen'];
  $namear = $_POST['namear'];


echo $sql = "INSERT INTO TESTTABLE (ID,USERNAME,PASSWORD,NAMEEN,NAMEEN) VALUES (:id,:username,:password,:nameen,:namear)";
  $compiled = oci_parse($conn, $sql);

  oci_bind_by_name($compiled, ':id', $id);
  oci_bind_by_name($compiled, ':username', $username);
  oci_bind_by_name($compiled, ':password', $password);
  oci_bind_by_name($compiled, ':nameen', $nameen);
  oci_bind_by_name($compiled, ':namear', $namear);

  oci_execute($compiled);

  if (! oci_execute($compiled)) {
    var_dump(oci_error()); 
} }

1 个答案:

答案 0 :(得分:1)

您的INSERT语句中有两个相同的字段,称为“ NAMEEN”:

aa.pt <> 'Ins'

您要:

INSERT INTO TESTTABLE
(ID,USERNAME,PASSWORD,NAMEEN,NAMEEN) VALUES ...