0

I have a little problem with my script. When I try to run it I receive "Parse error: syntax error, unexpected T_STRING" as long as I have ' sign in my code. When I change all ' into " then I have the same error. So I have to change all " into '.

Here is my code:

<?php
      PutEnv(TNS_ADMIN='C:\Programy\OracleDeveloper10g\NETWORK\ADMIN\');
      $conn = oci_connect("user", "pass", "dbstring");
      if (!$conn)
      {
        $e = oci_error();
        print $e;
        exit;
      }
      else
      {
        $stmt = OCIParse($conn, "SELECT password FROM USERS WHERE username=szymon");
        OCIExecute($stmt, OCI_DEFAULT);
      while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
      foreach ($row as $item) {
       $password = $item;
      }
        if ($password != $_POST[password]){
          $stmt = OCIParse($conn, "EXECUTE drop_tables");
          $message = "Tabele zostały usunięte";
        }
        else {
          $message = "Podane hasło jest niepoprawne";
        }
      }
   }
?>
1
  • 2
    as far as i can see, the code you posted is bug-free ... Commented Nov 19, 2009 at 18:04

4 Answers 4

5

Try

putenv("TNS_ADMIN='C:\Programy\OracleDeveloper10g\NETWORK\ADMIN\'");

If you look at the docs for putenv() it shows everything in quotes.

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

Comments

2

The problem is the backslashes in the TNS_ADMIN path. The last backslash escapes the closing '.

Try doubling all backslashes:

C:\\Programy\\OracleDeveloper10g\\NETWORK\\ADMIN\\

Comments

2

make sure you escape your \

Comments

2

On this line:

PutEnv(TNS_ADMIN='C:\Programy\OracleDeveloper10g\NETWORK\ADMIN\');

The slashes cause the ending quote to be escaped. Try it like this:

PutEnv(TNS_ADMIN='C:\\Programy\\OracleDeveloper10g\\NETWORK\\ADMIN\\');

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.