Hello there,
I have searched the forum for some solutions bordering on the above named error but it seems every one has got their own perculiar issue same as me hence my request for some suggestion in my own case.
I have the following query in my scripts which is working but I have issues dealing with the undefined offset error notices which am not too comfortable with though the output it ok.
$query = "INSERT INTO rmc_raw_data(device_id,nmea,rmc_time, signal, latitude, north, longitude, east, speed, track_angle, rmc_date, magnetic_variation, west,check_sum,handovers,data_source,test_case_id) values";
while (($data = fgetcsv($handle)) !== FALSE)
{
$numlines++;
$myDay=substr($data[10], 0,2);
$myMonth=substr($data[10], 2,2);
$myYear=substr($data[10], 4,2);
$rmc_date = convertToNiceDate($myDay, $myMonth, 2000+$myYear);
$longitude = convertToDegrees($data[6]);
$latitude = convertToDegrees($data[4]);
//$query .="('$data[0]','$data[1]','$data[2]','$latitude','$data[4]','$longitude','$data[6]','$data[7]','$data[8]','$rmc_date'),";
$query .="('$data[0]','$data[1]','$data[2]','$data[3]','$latitude','$data[5]','$longitude','$data[7]','$data[8]','$data[9]','$rmc_date','$data[11]','$data[12]','$data[13]', '$data[14]','$data[15]', '$data[16]'),";
}
$query = substr($query, 0,-1);
//echo $query;
mysql_query($query) or die(mysql_error());
The error is this:
(
! ) Notice: Undefined offset: 14 in C:\\wamp\\www\\setapro\\mobile_importmanager.php on line 68
( ! ) Notice: Undefined offset: 15 in C:\\wamp\\www\\setapro\\mobile_importmanager.php on line 68
( ! ) Notice: Undefined offset: 16 in C:\\wamp\\www\\setapro\\mobile_importmanager.php on line 68
...
...
… and continous like that till the end of script.
I do know that the problem is around the row data values of
'$data[14]'
,
'$data[16]'
and
'$data[15]'
respectively.
I think my PHP skills are still wanting in resolving this matter as am still learning. So could someone please tell me why is this? Many thanks.
Regards