Results 1 to 3 of 3

Thread: MySQL syntax

  1. #1
    Join Date
    Dec 2011
    Posts
    2

    Unanswered: MySQL syntax

    "SELECT Username, IP, Bantype FROM `bans` WHERE (IP = '192.168.1.3' AND Bantype = '1' AND Time = '0') OR (IP = '192.168.1.3' AND Bantype = '2' AND Time > '1') OR (IP >= '192.158' AND IP <= '192.178' AND Bantype = '3' AND Time = '0')"

    I dont really know how to explain this..

    WHERE
    (IP = '192.168.1.3' AND Bantype = '1' AND Time = '0')
    OR
    (IP = '192.168.1.3' AND Bantype = '2' AND Time > '1')
    OR
    (IP >= '192.158' AND IP <= '192.178' AND Bantype = '3' AND Time = '0')

    Something is wrong in the syntax, i have someone in the table named "bans" and his IP is 192.168.1.3 and the bantype = 1
    Last edited by Unknown123; 12-21-11 at 20:08.

  2. #2
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    What is the error message that is returned which will give us an idea of where your syntax error exists? I suspect it is with the field Time which is a reserved word in MySQL and you should have this declared as `Time` in your SQL statement.
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

  3. #3
    Join Date
    Dec 2011
    Posts
    2
    Thank you, you're my hero (Y)


    Problem: Solved, thanks to it-iss.com

Posting Permissions

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