mybestshot Posted February 20, 2008 Share Posted February 20, 2008 I got in table A 1 field : *hc-v3.6,GPS,A,N,47"07'21.8,E,015"12'36.1,000.0,129.1,00* need to put this in another table called B fieldname firmware:*hc-v3.6 What:GPS Location:A latitude:N,47"07'21.8 longitude:E,015"12'36.1 speed:000.0 direction:129.1 ab:00* How can i do this ? Quote Link to comment https://forums.phpfreaks.com/topic/92106-split-1-mysqlfield-to-many-other-fields-delimmited/ Share on other sites More sharing options...
fj1200 Posted February 21, 2008 Share Posted February 21, 2008 Here's how I do a similar thing but there may be better ways if anyone can suggest them? Get the field into a variable. Have you got a DB query set up? field = $ORIG_DATA $DATA=(explode(",",$ORIG_DATA)); //Splits it into an array $DATA on the ',' delimiter I assign a named variable cos I find it easier when troubleshooting but you don't have to. You could just use $DATA[n]. $Firmware = ($DATA[0]); $GPS= ($DATA[1]); $Location = ($DATA[2]); $Latitude = ($DATA[3]); $Longitude = ($DATA[4]); $Speed = ($DATA[5]); $direction = ($DATA[6]); $ab = ($DATA[7]); You then simply use the $Firmware, $GPS etc wherever you need them. Quote Link to comment https://forums.phpfreaks.com/topic/92106-split-1-mysqlfield-to-many-other-fields-delimmited/#findComment-472628 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.