If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > MySQL syntax

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-21-11, 18:49
Unknown123 Unknown123 is offline
Registered User
 
Join Date: Dec 2011
Posts: 2
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 19:08.
Reply With Quote
  #2 (permalink)  
Old 12-22-11, 04:57
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 620
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
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #3 (permalink)  
Old 12-22-11, 08:05
Unknown123 Unknown123 is offline
Registered User
 
Join Date: Dec 2011
Posts: 2
Thank you, you're my hero (Y)


Problem: Solved, thanks to it-iss.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On