Re: Oracle and PHP question

From: Gerard H. Pille <ghp_at_skynet.be>
Date: Sun, 12 Mar 2006 15:52:21 +0100
Message-ID: <441435A5.6050208_at_skynet.be>


Steff wrote:
> 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);
> ?>
>
>
Try giving an alias to the concatenated columns?

$query="

  select  a.fulfiller_firstname|| ' '||a.fulfiller_lastname as fulfname,
          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 as cliename
    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;"; Received on Sun Mar 12 2006 - 15:52:21 CET

Original text of this message