0

My php script is as follows:

if (!empty($_POST['action'])){
          PutEnv("TNS_ADMIN='C:\\Programy\\OracleDeveloper10g\\NETWORK\\ADMIN\\'");
          $conn = oci_connect('s14', 'sm19881', 'umain');
          if (!$conn)
          {
            $e = oci_error();
            print "Wygląda na to że mamy jakieś błędy\n";
            print htmlentities($e['message']);
            exit;
          }
          else
          {
            $stmt = oci_parse($conn, "INSERT INTO USERS (IS_SUPERUSER, ID, IS_ACTIVE, LAST_NAME, E_MAIL, ACCOUNT_NUMBER, FIRST_NAME, NIP, IS_STAFF, MOBILE_PHONE_NUMBER, USERNAME, AVG_EVALUATION) VALUES (0, NEXT_USER.NEXTVAL, 1, 'surname', 'email', '112233', 'name', '123', 0, '123', 'nick', 0.00");
            $execute = oci_execute($stmt, OCI_DEFAULT);
            if (!$execute){
              $e = oci_error($stmt);
              print "Wygląda na to że mamy jakieś błędy:\n";
              print htmlentities($e['message']);
              exit;
            }
            $message = 'Użytkownik został dodany';
          }
        }

When I try to execute it i receive ORA-00917: missing comma error in line with oci_execute() method. Where should be this missing comma?

3 Answers 3

3

You're actually missing the inner closing ) for the VALUES list. The closing paren you have is just ending the oci_parse call.

Sign up to request clarification or add additional context in comments.

Comments

1

You left off the closing ) in your VALUES.

Comments

1

This:

$stmt = oci_parse($conn, "INSERT INTO USERS (IS_SUPERUSER, ID, IS_ACTIVE, LAST_NAME, E_MAIL, ACCOUNT_NUMBER, FIRST_NAME, NIP, IS_STAFF, MOBILE_PHONE_NUMBER, USERNAME, AVG_EVALUATION) VALUES (0, NEXT_USER.NEXTVAL, 1, 'surname', 'email', '112233', 'name', '123', 0, '123', 'nick', 0.00");

...should be:

$stmt = oci_parse($conn, "INSERT INTO USERS (IS_SUPERUSER, ID, IS_ACTIVE, LAST_NAME, E_MAIL, ACCOUNT_NUMBER, FIRST_NAME, NIP, IS_STAFF, MOBILE_PHONE_NUMBER, USERNAME, AVG_EVALUATION) VALUES (0, NEXT_USER.NEXTVAL, 1, 'surname', 'email', '112233', 'name', '123', 0, '123', 'nick', 0.00"));

Scroll to the end to see the difference - the missing ) used to close the oci_parse method call.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.