Results 1 to 3 of 3

Thread: SQL Syntax Error

  1. #1
    Join Date
    Aug 2006
    Location
    Ohio
    Posts
    266
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default SQL Syntax Error

    Hello, I am having an issue with an sql query. Here is my code:
    PHP Code:
    $get mysql_query("SELECT * FROM `teams` ORDER BY name ASC LIMIT $cur$max") or die ("Error Getting Teams! \n<br />\n" .mysql_error()); 
    When I run that I get this error:
    Code:
    Error Getting Teams!
    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 '' at line 1
    When I take out the limit section or the order by section, it works. Any reason for this. Thanks
    Thanks DD, you saved me countless times

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Looks fine, but that probably means that the values of the $cur or $max variables are wrong, or perhaps do not exist (hence why it says the error is an empty string).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Aug 2006
    Location
    Ohio
    Posts
    266
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, I guess the error was in an include that was not getting the values. Its working now
    Thanks DD, you saved me countless times

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
  •