Yes, thanks Jsb.
This is what I did and it seems to work.
$select_sqlsrv="SELECT idGPS,Palmare, Operatore, DATA, ORA,
LEFT(LATIT ,2) + ‘.’ + SUBSTRING(LATIT ,3,2) + SUBSTRING(LATIT ,6,4) AS LATIT,
SUBSTRING(LONGI ,2,2) + ‘.’ + SUBSTRING(LONGI ,4,2) + SUBSTRING(LONGI ,7,4) AS LONGI,
ALTIT, KMH FROM dbo.VALORIGPS WHERE DATA BETWEEN ‘{rif_data_travel}’ AND ‘{rif_data_travel1}’ ";
sc_select(my_data, $select_sqlsrv, “conn_mssql_log”);
if ({my_data} === false)
{
echo "Access error. Message ";
}
else
{
while (!$my_data->EOF)
{
{idGPS} = $my_data->fields[0];
{Palmare} = $my_data->fields[1];
{Operatore} = $my_data->fields[2];
{DATA} = $my_data->fields[3];
{ORA} = $my_data->fields[4];
{LATIT} = $my_data->fields[5];
{LONGI} = $my_data->fields[6];
{ALTIT} = $my_data->fields[7];
{KMH} = $my_data->fields[8];
$sql_insert = “INSERT INTO gps_data (idGPS, Palmare, Operatore, DATA, ORA, LATIT, LONGI, ALTIT, KMH)
VALUES ({idGPS},’{Palmare}’,’{Operatore}’,’{DATA}’,’{ORA}’,’{LATIT}’,’{LONGI}’,’{ALTIT}’, {KMH})
ON DUPLICATE KEY UPDATE Operatore = ‘{Operatore}’ , DATA = ‘{DATA}’, ORA = ‘{ORA}’,
LATIT = ‘{LATIT}’, LONGI = ‘{LONGI}’, ALTIT = ‘{ALTIT}’, KMH = {KMH}”;
sc_exec_sql($sql_insert);
echo {idGPS}." - “. {Palmare}.” - “. {Operatore}.” - “. {DATA}.” - “. {ORA} .” - “.{LATIT}.” - “. {LONGI} .” - “. {ALTIT} .” - “. {KMH} .”<br/>";
$my_data->MoveNext();
}
$my_data->Close();
}