For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > March 2006 > PHP and Oracle









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PHP and Oracle
Steff

2006-03-10, 6:56 pm

Hello everyone,

I am trying to display in an array the result of a query. Unfortunately I
cannot concatenate 2 fields
in 1, it makes an error :

Warning: ociexecute() [function.ociexecute]: ORA-00911: Caractère non valide
in
c:\pageWeb\tasks_to_do.php on line 103

Fulfiller Request Type Task Name Start Date End Date Expected Delivery date
Client
Warning: ocifetchinto() [function.ocifetchinto]: ORA-24374: définition non
exécutée
après extraction ou exécution et extraction in c:\pageWeb\tasks_to_do.php on
line 117

if I use query without the concatenate operator it works... but I need to
concatenate
those fields though...

Can anyone help me out?

here is my code:


<?php


// connexion
$conn = ocilogon("stephane","Stef1975",$bdtest05);
// préparation du Select
$query="select a.fulfiller_firstname|| ' '||a.fulfiller_lastname
,b.request_type_name
,c.task_name
,c.task_start_date
,c.task_end_date
,d.request_wished_delivery_date
,e.client_firstname||' '||e.client_lastname
from fulfillers a
,request_types b
,tasks c
,requests d
,clients e
where c.task_fulfiller_id = a.fulfiller_id
and c.task_request_id = d.request_id
and d.request_request_type_id = b.request_type_id
and d.request_client_id = e.client_id;";

$ordre = OCIParse ($conn, $query);
OCIExecute ($ordre);
$ncols = OCINumCols($ordre);
// affiche les lignes tant qu'il y en a
// et les colonnes une par une
print "<TABLE BORDER=1> ";
print "<TR>";
print "<TD>Fulfiller</TD>";
print "<TD>Request Type</TD>";
print "<TD>Task Name</TD>";
print "<TD>Start Date</TD>";
print "<TD>End Date </TD>";
print "<TD>Expected Delivery date</TD>";
print "<TD>Client</TD>";

while (OCIFetchInto ($ordre, $ligne, OCI_NUM)) {
print "<TR> ";
for ( $i=0;$i < $ncols; $i++) {
print "<TD> $ligne[$i] </TD>" ;
}
print "</TR> ";
}// libere les ressources
OCIFreeCursor ($ordre);
OCILogoff($conn);
?>


IT-Manager

2006-03-10, 6:56 pm

do <? print $query; ?> and what you see?


rlee0001

2006-03-10, 6:56 pm

So you tried...

$query="select a.fulfiller_firstname, a.fulfiller_lastname ...
..
..
..

And that worked? Can you try this:

$query="select concat(a.fulfiller_firstname, ' ',
a.fulfiller_lastname) AS fullname ...
..
..
..

Maybe using the concat function and giving it an AS name would fix the
problem. The AS should be optional but I like to use it when I use
function in the SELECT clause. But other than that it all looks pretty
good. Is || valid in oracle or is that operator PostgreSQL only? I
always thought it was a PostgreSQL thing.

-Robert

Tommy Gildseth

2006-03-10, 6:56 pm

rlee0001 wrote:

> good. Is || valid in oracle or is that operator PostgreSQL only? I
> always thought it was a PostgreSQL thing.


Nope, the || is the concatenation operator in the SQL standard. It's only
mySQL that, for whatever reasons they have for doing what they do, decided
it would be a good idea to use || as the OR operator.


--
Tommy
http://design.twobarks.com/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com