szaman
szaman

Reputation: 6756

ORA-00917 in php script

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?

Upvotes: 0

Views: 1358

Answers (3)

OMG Ponies
OMG Ponies

Reputation: 332491

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.

Upvotes: 1

Donnie
Donnie

Reputation: 46903

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

Upvotes: 3

Frank Krueger
Frank Krueger

Reputation: 70973

You left off the closing ) in your VALUES.

Upvotes: 1

Related Questions