Tuesday, 15 May 2012

Either PHP convert JSON values to have keys or PostgreSQL assign values to keys -


I just need to store the text (the rows have its own different date).

Either ...

1. How do I read the following value (s) in a PHP array, which I can iterate through the foreach loop?

... or ...

2. How do I assign a value to a table a key (which not is explicitly explained in the PostGrace SQL document)?

  {"." 022 x 2.031 "} {" 012 x 3.621 "}  

So I have a single measurement value formally formatted as the first format (will be considered as text from blank). I try to convert data into PHP in line and for invalid argument to get the for foreach () the following:

  $ array = json_decode ($ Row1 ['material_size']); Foreach ($ array as $ k1) {echo $ k1;}  

After doing this, even more I decided to see if I could directly convert data via postgrow SQL:

  SELECT array_to_json (content_size) AS from the content_size table;  < 
  $ array = json_decode ($ row1 ['material_size']); print_r ($ array); array ([ 0] = & gt; .022 x 2.031)  

No comments:

Post a Comment