Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3396872
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:27:35+00:00 2026-05-18T04:27:35+00:00

This perhaps is a peculiar problem and I do need a second eye. I

  • 0

This perhaps is a peculiar problem and I do need a second eye. I am running th following query in my PHP script but am having problem finding the errring line in my query. When I echo the $query, I see the output which valid but the query gives and error at the end of the output saying:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ”),(‘1′,’$GPRMC’,’040837.002′,’A’,’60.15465′,’N’,’24.7436′,’E’,’0.5′,1970,01,01” at line 1

I am running the following query:

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) 
         VALUES";
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
  $numlines++;

  $myDay=substr($data[9], 0,2);
  $myMonth=substr($data[9], 2,2);
  $myYear=substr($data[9], 4,2);            

  $rmc_date = convertToNiceDate($myDay, $myMonth, 2000+$myYear);

  $longitude = convertToDegrees($data[6]);
  $latitude  = convertToDegrees($data[4]);

  $query .= "('$data[0]','$data[1]','$data[2]','$data[3]','$latitude','$data[5]','$longitude','$data[7]','$data[8]',$rmc_date','$data[10]','$data[11]','$data[12]'),";
}

$query = substr($query, 0,-1);

echo $query;
mysql_query($query) or die(mysql_error());

The query imports and manipulates data from a text file which has the following sample of data lines which are comma delimited:

//input data
1,$GPRMC,080323.460,A,6013.45368,N,02445.28396,E,21.6,134.0,070610,6.9,W,A*2A
1,$GPRMC,080327.000,A,6013.44424,N,02445.31214,E,9.0,135.2,070610,6.9,W,A*1E
1,$GPRMC,132305.000,V,,,,,,,070610,,,N*4B
1,$GPRMC,132320.000,V,,,,,,,070610,,,N*4C
1,$GPRMC,132335.000,V,,,,,,,070610,,,N*48
1,$GPRMC,132350.000,V,,,,,,,070610,,,N*4B
1,$GPRMC,134841.000,V,,,,,,,070610,,,N*46
1,$GPRMC,134856.000,A,6009.32417,N,02444.63687,E,1.7,124.8,070610,6.9,W,A*1A
1,$GPRMC,134911.000,A,6009.32239,N,02444.63356,E,,,070610,,,A*64
1,$GPRMC,134927.000,V,,,,,,,070610,,,N*47
1,$GPRMC,155411.405,V,,,,,,,070610,,,N*49
-------

While the query outputed the result to screen as I tested to see, it also gave an error at the following point of the output i.e where it terminated:

//output data to be inserted
        ('1','$GPRMC','142346.000','A','60.15675','N','24.74189','E','14.1',1970,01,01','290610','6.9','W'),    ('1','$GPRMC','142349.000','A','60.15656','N','24.74203','E','13.5',1970,01,01','290610','6.9','W'),    ('1','$GPRMC','142402.000','A','60.15565','N','24.74287','E','13.2',1970,01,01','290610','6.9','W'),    ('1','$GPRMC','142411.000','A','60.1551','N','24.74347','E','7.3',1970,01,01','290610','6.9','W'),    ('1','$GPRMC','142414.000','A','60.15507','N','24.74346','E','',1970,01,01','290610','',''),    ('1','$GPRMC','142417.000','A','60.15514','N','24.74358','E','6.4',1970,01,01','290610','6.9','W'),    ('1','$GPRMC','142423.000','A','60.15524','N','24.74371','E','',1970,01,01','290610','',''),    ('1','$GPRMC','142435.000','A','60.15512','N','24.74365','E','',1970,01,01','290610','',''),
('1','$GPRMC','142447.000','V','0','','0','','',1970,01,01','290610','',''),
('1','$GPRMC','142459.000','V','0','','0','','',1970,01,01','290610','',''),
('1','$GPRMC','062917.637','V','0','','0','','',1970,01,01','070610','',''),
('1','$GPRMC','062932.000','V','0','','0','','',1970,01,01','070610','',''),
('1','$GPRMC','063206.392','V','0','','0','','',1970,01,01','070610','',''),
('1','$GPRMC','080238.101','V','0','','0','','',1970,01,01','070610','',''),
('1','$GPRMC','080253.000','V','0','','0','','',1970,01,01','070610','',''),
('1','$GPRMC','080305.000','V','0','','0','','',1970,01,01','070610','',''),
('1','$GPRMC','080308.000','V','0','','0','','',1970,01,01','070610','','')


You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '','070610','6.9','W'),('1','$GPRMC','080327.000','A','60.22407','N','24.7552','E' at line 1

I have been working to trace the error but no solution. I had achieved same result with a similar nature of file without qualms. But this is getting me nuts.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:27:35+00:00Added an answer on May 18, 2026 at 4:27 am

    $rmc_date is not quoted properly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize this perhaps a naive question but still I cant figure out how
This is perhaps similar to previous posts, but I want to be specific about
I'm a bit perplexed by drag and drop in wxPython (but perhaps this questions
This seems like perhaps a naive question, but I got into a discussion with
This question is related to (but perhaps not quite the same as): Does Django
I'm perhaps being a bit lazy asking this here, but I'm just getting started
Or perhaps this is a manual install only deal.
Perhaps this is a naive question. In my understanding, ASP.NET MVC cannot work with
[EDIT] Hmm. Perhaps this question should be titled what is the default user-input dialog
This has always bugged me. Perhaps someone with some hardcore knowledge of .NET internals

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.