tags:

views:

73

answers:

3

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?

+1  A: 

You left off the closing ) in your VALUES.

Frank Krueger
+2  A: 

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

Donnie
stupid mistake, thanks to all :P
szaman
+1  A: 

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.

OMG Ponies