java - arraylists of longitude and latitude pass them in php and insert them to mysql,how? -


i have 2 arraylists (longitude elements , latitude elements) want pass them in php script , in mysql(wamp).

for (int = 0; < latitude_mysql.size(); i++) {     namevaluepairs.add(new basicnamevaluepair("latitude_mysql",latitude_mysql.get(i)));     namevaluepairs.add(new basicnamevaluepair("longitude_mysql",longitude_mysql.get(i))); }//by way send them in php script,but m not sure if appropriate   

in php writing don t know how continue:

    if ($stmt = $mysqli->prepare("insert route(latitude,longitude,trek_id_r)     values (?, ? , ? )"))     {     /* set our params */     $lati[] = $_post['latitude_mysql[]'];    $longi[] = $_post['longitude_mysql[]']; 

and then???

i need latitude , longitude inserted respectively, i.e: if values are:

longitude_mysql: 30.24 , 50.24 latitude_mysql: 23.43 , 24.56 trek_id_r= 2 

in mysql in table route need result:

longitude | latitude | trek_id_r 30,24     | 23,43    | 2 50,24     | 24,56    | 2 

i have read converting arraylists json or implode , multiple mysqli insert relevant useful , understandable.

you need iterate coord list , insert each in mysql. have 2 inserts in case


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -