Jump to content

Retrieve database dump values


gansai

Recommended Posts

How to retrieve database array values from the object 'name' in php

array (size=21)
  9 => 
    object(stdClass)[1017]
      public 'id' => string '9' (length=1)
      public 'dept' => string '2' (length=1)
      public 'class' => string '1' (length=1)
      public 'section' => string '1' (length=1)
      public 'name' => string 'plant modeling software, Smart 3D is a full suite of complementary software' (length=75)
      
  14 => 
    object(stdClass)[1018]
      public 'id' => string '14' (length=2)
      public 'dept' => string '2' (length=1)
      public 'class' => string '1' (length=1)
      public 'section' => string '2' (length=1)
      public 'name' => string 'integrated solution for all materials and supply chain management.]' (length=59)
     
  2 =>
    object(stdClass)[1037]
      public 'id' => string '1' (length=1)
      public 'course' => string '2' (length=1)
      public 'dept' => string '2' (length=1)
      public 'class' => string '1' (length=1)
      public 'section' => string '2' (length=1)
      public 'name' => string 'stakeholders in the EPC supply chain]' (length=46)

 

Link to comment
Share on other sites

I tried foreach, but I could get the result.

I have a function which returns array values (as shown above). 

Tried: 

function triple_plus(id)

{

    ..............................

   $result = array();

   return var_dump($result);

}

triple_plus(id);

Output:

array (size=21)
  9 => 
    object(stdClass)[1017]
      public 'id' => string '9' (length=1)
      public 'dept' => string '2' (length=1)
      public 'class' => string '1' (length=1)
      public 'section' => string '1' (length=1)
      public 'name' => string 'plant modeling software, Smart 3D is a full suite of complementary software' (length=75)
      
  14 => 
    object(stdClass)[1018]
      public 'id' => string '14' (length=2)
      public 'dept' => string '2' (length=1)
      public 'class' => string '1' (length=1)
      public 'section' => string '2' (length=1)
      public 'name' => string 'integrated solution for all materials and supply chain management.]' (length=59)
     
  2 =>
    object(stdClass)[1037]
      public 'id' => string '1' (length=1)
      public 'course' => string '2' (length=1)
      public 'dept' => string '2' (length=1)
      public 'class' => string '1' (length=1)
      public 'section' => string '2' (length=1)
      public 'name' => string 'stakeholders in the EPC supply chain]' (length=46)

From the output, I want only the name column

 

Link to comment
Share on other sites

The array was not from the database. It was a function output, where it displays all array values. I want to convert these array values to string. I want to extract the id, section and name.

 

Link to comment
Share on other sites

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.