[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

ORA-00911: invalid character error..pls help!!!

Posted on 2002-07-11
11
Medium Priority
?
1,727 Views
Last Modified: 2012-08-13
hi experts,

I'm having a problem of running a sql statement below using oci. Error appear as below:


//Query to get number of ticket by status
  $query = "SELECT DISTINCT events.t_id, t_summary, t_category, ";
  $query .= "e_status, e_assignedto,t_priority, t_user,t_timestamp_opened, ";
  $query .= "e_timestamp, events.e_id, t_id2, category.c_name, t_status ";
  $query .= "FROM ticket, events, tmpeid, category ";
  $query .= "WHERE ticket.t_id=events.t_id";
  $query .= " AND (events.e_id=tmpeid.e_id)";

  $query .= " AND (ticket.t_category = category.c_id)";
  //$query .= " AND (contact.country = '$usercountry')";
  //zamir buang contact.country, dari query

  if (($type == r) || ($type == 'or')){
          //$query .= " AND (contact.country = '$usercountry')";
    $query .= " AND (events.e_assignedto='$rep_contact_id')";
  }
  if ($type == c) {
    $query .= " AND (ticket.t_id2 LIKE \"$usercountry%\")";
  }
  if ($type == o) {
          //$query .= " AND (ticket.t_id2 LIKE \"$countryid%\")";
  }       $query .= " AND (events.e_assignedto='$rep_contact_id')";
  $query .= "$queryorderby";
  //echo "<br>$query<br>";
  $stmt2 = OCIParse($oci_link,$query);
  OCIExecute($stmt2); //line 120 here


error:
Warning: OCIStmtExecute: ORA-00911: invalid character in c:\apache group\apache\htdocs\oictrade1\scripts\vj_viewtickets.scp.php on line 120



pls help me

TQ
0
Comment
Question by:zamirjalil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 5

Expert Comment

by:Hamlet081299
ID: 7145466
Please indicate likely value of $type...
0
 

Author Comment

by:zamirjalil
ID: 7145470
ok Hamlet ..

$type = c
0
 
LVL 5

Expert Comment

by:Hamlet081299
ID: 7145472
Looks like it could be a problem with the double quotes used in a couple of places...

Change...

   $query .= " AND (ticket.t_id2 LIKE \"$usercountry%\")";

... to ...

   $query .= " AND (ticket.t_id2 LIKE '$usercountry%')";

Likewise anywhere else where \" has been used around string values.

This is because double quotes are for column names.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:zamirjalil
ID: 7145496
ok Hamlet ..

$type = c
0
 

Author Comment

by:zamirjalil
ID: 7145505
Hemlet..

I paste the code after change it below:
  if (($type == 'r') || ($type == 'or')){
          //$query .= " AND (contact.country = '$usercountry')";
    $query .= " AND (events.e_assignedto='$rep_contact_id')";
  }
  if ($type == 'c') {
    $query .= " AND (ticket.t_id2 LIKE '$usercountry%')";
  }
  if ($type == 'o') {
          $query .= " AND (ticket.t_id2 LIKE '$countryid%')";
  }       //$query .= " AND (events.e_assignedto='$rep_contact_id')";
  $query .= "$queryorderby";
  //echo "<br>$query<br>";
  $stmt2 = OCIParse($oci_link,$query);
  OCIExecute($stmt2);

  $num_pending =0;
  $num_open=0;
  $num_cancel=0;
  $num_closed=0;
  $num_registered=0;

            while (OCIFetch($stmt2)){ //line 128 here



i still got the same error

Warning: OCIStmtExecute: ORA-00911: invalid character in c:\apache group\apache\htdocs\oictrade1\scripts\vj_viewtickets.scp.php on line 120

and

Warning: OCIFetch: ORA-24374: define not done before fetch or execute and fetch in c:\apache group\apache\htdocs\oictrade1\scripts\vj_viewtickets.scp.php on line 128


0
 
LVL 5

Expert Comment

by:Hamlet081299
ID: 7145513
Put an echo after the OCIParse like this ...

$stmt2 = OCIParse($oci_link,$query);
echo $stmt2;

... and have a look at that.
0
 
LVL 5

Expert Comment

by:Hamlet081299
ID: 7145522
What is the value of $queryorderby ?
0
 
LVL 5

Expert Comment

by:Hamlet081299
ID: 7145524
Probably the best thing is to do an echo of $query, just before the OCIParse.  If you post that I'm sure I'll see the problem.

I suspect it'll be one of these things...

* Use of " instead of '
* A semi-colon at the end of the query
* Missing a space between some tokens
0
 

Author Comment

by:zamirjalil
ID: 7145586
Hemlet..

I paste the code after change it below:
  if (($type == 'r') || ($type == 'or')){
          //$query .= " AND (contact.country = '$usercountry')";
    $query .= " AND (events.e_assignedto='$rep_contact_id')";
  }
  if ($type == 'c') {
    $query .= " AND (ticket.t_id2 LIKE '$usercountry%')";
  }
  if ($type == 'o') {
          $query .= " AND (ticket.t_id2 LIKE '$countryid%')";
  }       //$query .= " AND (events.e_assignedto='$rep_contact_id')";
  $query .= "$queryorderby";
  //echo "<br>$query<br>";
  $stmt2 = OCIParse($oci_link,$query);
  OCIExecute($stmt2);

  $num_pending =0;
  $num_open=0;
  $num_cancel=0;
  $num_closed=0;
  $num_registered=0;

            while (OCIFetch($stmt2)){ //line 128 here



i still got the same error

Warning: OCIStmtExecute: ORA-00911: invalid character in c:\apache group\apache\htdocs\oictrade1\scripts\vj_viewtickets.scp.php on line 120

and

Warning: OCIFetch: ORA-24374: define not done before fetch or execute and fetch in c:\apache group\apache\htdocs\oictrade1\scripts\vj_viewtickets.scp.php on line 128


0
 

Author Comment

by:zamirjalil
ID: 7145591
hemlet..

after put echo , it display:
stmt2 =Resource id #8

what does it mean?


$queryorderby is as follows:



if ($orderby == "t_summary") {
       if (isset($tmp_t_summary)) {
        $queryorderby = " order by t_summary, t_timestamp_opened;";
      }
        else {
        $queryorderby = " order by t_summary DESC, t_timestamp_opened;";
      }
   }
   elseif ($orderby == "t_category") {
       if (isset($tmp_t_category)) {
        $queryorderby = " order by t_category, t_timestamp_opened;";
      }
        else {
        $queryorderby = " order by t_category DESC, t_timestamp_opened;";
      }
   }
   elseif ($orderby == "e_status") {
      if (isset($tmp_e_status)) {
        $queryorderby = " order by e_status, t_timestamp_opened;";
      }
              else {
        $queryorderby = " order by e_status DESC, t_timestamp_opened;";
      }
   }
   elseif ($orderby == "t_user") {
      if (isset($tmp_t_user)) {
        $queryorderby = " order by e_assignedto, t_timestamp_opened;";
      }
      else {
        $queryorderby = " order by e_assignedto DESC, t_timestamp_opened;";
      }
    }
   elseif ($orderby == "t_id") {
      if (isset($tmp_t_id)) {
        $queryorderby = " ORDER BY t_id, t_timestamp_opened;";
      }
      else {
        $queryorderby = " ORDER BY t_id DESC, t_timestamp_opened;";
      }
    }
   elseif ($orderby == "t_timestamp_opened") {
      if (isset($tmp_t_timestamp_opened)) {
        $queryorderby = " order by t_timestamp_opened;";
      }
      else {
        $queryorderby = " order by t_timestamp_opened DESC;";
      }
    }
   else {
      if (isset($tmp_t_priority)) {
        $queryorderby = " ORDER BY t_priority DESC;"; //, t_timestamp_opened;";
      }
      else {
        $queryorderby = " ORDER BY t_priority;"; //, t_timestamp_opened;";
      }
   }
0
 
LVL 5

Accepted Solution

by:
Hamlet081299 earned 200 total points
ID: 7145617
aha ... as noted in my previous comment, I believe the problem is with the ";" on the end of any of your order by clauses.

Try removing all of these, for example...

$queryorderby = " order by t_summary, t_timestamp_opened;";

... should be ...

$queryorderby = " order by t_summary, t_timestamp_opened";


OCIParse will not like that semicolon.


I hope that's it because I'll be offline shortly.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question