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


i need store text (rows have own separate date).

either...

1. how read (either of) following value(s) in php array can iterate on via foreach loop?

...or...

2. how insert into table value assigned key (which not clarified @ in postgresql documentation)?

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

so have single measurement values (to treated text purely records) formatted first format above. try convert row data in php , invalid argument supplied foreach() following:

$array = json_decode($row1['material_size']);  foreach ($array $k1) {echo $k1;} 

so after doing more searching , reading decided see if convert data via postgresql directly:

select array_to_json(material_size) material_size table; 

now array data correctly...

$array = json_decode($row1['material_size']); print_r($array);  array (     [0] => .022 x 2.031 ) 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

ios - Possible to get UIButton sizeThatFits to work? -