SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Errors #1064.

  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2008
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Errors #1064.

    I have php functions that make MySQL queries into GPS database information. I can do the upload GPX files to my uploaded directory however when I try to send the add info through a web form the webserver that I am using display these errors :
    Code:
    Error: (1064) 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 '(*) FROM geo_comments WHERE route LIKE geo_routes.id) AS comments,(SELECT name F' at line 1
    Code:
     
    Error: (1064) 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 '))*cos(radians(lat))*cos(radians(lng)-radians())+sin(radians())*sin(radians(lat)' at line 1
    Code:
    Error: (1064) 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 '(SELECT COUNT(*) FROM geo_comments WHERE route LIKE geo_routes.id) AS comments,(' at line 1
    The queries are following :
    PHP Code:
    $query "SELECT *,(SELECT COUNT (*) FROM geo_comments WHERE route LIKE geo_routes.id) AS comments,(SELECT name FROM geo_users WHERE geo_users.id LIKE geo_routes.property) AS owner  FROM geo_routes WHERE $condition ORDER BY $order LIMIT $limit"
    PHP Code:
    $query "SELECT geo_routes.*,(SELECT COUNT(*) FROM geo_comments WHERE route = id) AS comments,AVG(6371*acos(cos(radians($lat))*cos(radians(lat))*cos(radians(lng)-radians($lng))+sin(radians($lat))*sin(radians(lat)))) AS dist FROM (geo_points INNER JOIN geo_routes ON geo_points.route = geo_routes.id) WHERE geo_routes.id != $exclude GROUP BY geo_points.route ORDER BY dist ASC LIMIT $limit"
    PHP Code:
    $query .="SELECT *,MATCH(name,description),(SELECT COUNT(*) FROM geo_comments WHERE route LIKE geo_routes.id) AS comments,(SELECT name FROM geo_users WHERE geo_users.id LIKE geo_routes.property) AS owner FROM geo_routes WHERE MATCH(name,description) ORDER BY score LIMIT 1"
    Please can give me an opinion where are the errors.
    thanks.
    Djalma Bina.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,341
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    1. space after COUNT
    2. $lat probably not defined
    3. AGAINST missing

    all errors located exactly where the error message is pointing to
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •