php - Split mySQL result on comma -


i have mysql table looks this(with other columns didn't select): sql table

i have mysqli php query this:

$sql=('select point placemarks id < 5'); 

a result:

while ($row = $rs->fetch_assoc()) {       printf ("%s <br />", $row["point"]); 

-157.798176, 21.254402, 0  -157.804087, 21.253042, 0  -157.805289, 21.252882, 0 

first, want split result on comma. once have want insert values 'lat' , 'lng' columns php , mysqli. i've searched , tried couple hours. @ point i'm sure on wrong path.

unless need split , manipulate in php update lat/lng in db in 1 query perhaps:

update `placemarks` set `lat`=substring_index(`point`,",",1 ), `lng`=substring_index(`point`,",",-1 ); 

damnit - never noticed or acknowledged trailing zero

update `placemarks` set      `lat`=substring_index( substring_index(`point`,",",2 ),",",1 ),     `lng`=substring_index( substring_index(`point`,",",2 ),",",-1 ); 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -