zamirjalil
asked on
ORA-00911: invalid character error..pls help!!!
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_i d')";
}
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_i d')";
$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\oictra de1\script s\vj_viewt ickets.scp .php on line 120
pls help me
TQ
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
}
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
$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\oictra
pls help me
TQ
Please indicate likely value of $type...
ASKER
ok Hamlet ..
$type = c
$type = c
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.
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.
ASKER
ok Hamlet ..
$type = c
$type = c
ASKER
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_i d')";
}
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_i d')";
$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\oictra de1\script s\vj_viewt ickets.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\oictra de1\script s\vj_viewt ickets.scp .php on line 128
I paste the code after change it below:
if (($type == 'r') || ($type == 'or')){
//$query .= " AND (contact.country = '$usercountry')";
$query .= " AND (events.e_assignedto='$rep
}
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
$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\oictra
and
Warning: OCIFetch: ORA-24374: define not done before fetch or execute and fetch in c:\apache group\apache\htdocs\oictra
Put an echo after the OCIParse like this ...
$stmt2 = OCIParse($oci_link,$query) ;
echo $stmt2;
... and have a look at that.
$stmt2 = OCIParse($oci_link,$query)
echo $stmt2;
... and have a look at that.
What is the value of $queryorderby ?
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
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
ASKER
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_i d')";
}
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_i d')";
$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\oictra de1\script s\vj_viewt ickets.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\oictra de1\script s\vj_viewt ickets.scp .php on line 128
I paste the code after change it below:
if (($type == 'r') || ($type == 'or')){
//$query .= " AND (contact.country = '$usercountry')";
$query .= " AND (events.e_assignedto='$rep
}
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
$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\oictra
and
Warning: OCIFetch: ORA-24374: define not done before fetch or execute and fetch in c:\apache group\apache\htdocs\oictra
ASKER
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_op ened)) {
$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;";
}
}
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_op
$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;";
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.