Jump to content

Problem PHP with database


mr.web_developer

Recommended Posts

Hi all

 

Good morning / night / afternoon

 

I have a duplication problem when I need to print my records in PHP

First of all let's see the database table

 

O4H37571.jpg

 

As you can see the duplication happened duo to the approvers that mean if there is only one approver there will be no duplication

For example when I want to pint request number 1 it will print

 

1 - Cris - Hadi

1 - Cris - Jack

 

but I want it to be like this

 

1 - Cris - Hadi,Jack

 

and thank you for your time

Link to comment
https://forums.phpfreaks.com/topic/233878-problem-php-with-database/
Share on other sites

Are you talking about when you put the data into the database, or retrieve it. If retrieve, maybe this?

 

(php and mysql...you can adjust etc.)

 

$Requster_Name = "Cris";
$query = mysql_query('SELECT Request_Approvers FROM table_Name WHERE Requster_Name = $Requster_Name');
$approvers = mysql_fetch_array($query);
echo "$approvers[0]" ."$approvers[1]";

I want to print only 1 record for each request with all aprovers

I'm using Oracle

but I did try it. It doesn't work

 

see

  $Requster_ID = '1';

  $s1 = oci_parse($c, "select  SIG.Requster_ID, SIG.Requester_Name,SIG.APPROVERS

    from RequestT SIG

    where

    SIG.Requster_ID = '$Requster_ID'

    ");

    oci_execute($s1);

    $res1 = oci_fetch_array($s1, OCI_ASSOC);   

    echo "$res1[0]" . "$res1[1]";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.