Question

I am trying to connect articles of companies in K2 with their references which are also articles. There is not a problem to get the reference text from the article, but the problem is with extra fields which contain the person who added the testimonial. If I try to get the data from the database I get this:

[{"id":"5","value":"Zden\u011bk Salcman"},{"id":"6","value":"www.o2.cz"},{"id":"7","value":"supervizor ve firm\u011b Telef\u00f3nica Czech Republic, a.s."}]

Is there a way in PHP to make this nice data like:

Zdeněk Salcman
www.o2.cz
supervizor ve firmě Telefónica Czech Republic, a.s

Thank you for your answers.

Was it helpful?

Solution

That's json encoded data. First pass it to json_decode, and then you can loop over it

$fields = json_decode($fields);
foreach($fields as $field)
    echo $field->value;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top