MySQL problem
#1

SELECT * FROM `BanData` WHERE `Expires On` > NOW() AND `User`='Alex' OR `IP Address`='127.0.0.1'

Resulting in 0 rows but there are.. however, if I remove " OR `IP Address`='127.0.0.1' " it works fine..

help?
Reply
#2

Why have you got spaces in your column names?
Reply
#3

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
Why have you got spaces in your column names?
Why would that matter?
Reply
#4

Have you check your logs folder? It might be outputting something
Reply
#5

[09:11:33] [WARNING] CMySQLResult::GetRowData - invalid row ('1') or field index ('0')
[09:11:33] [WARNING] CMySQLResult::GetRowData - invalid row ('1') or field index ('1')
[09:11:33] [WARNING] CMySQLResult::GetRowData - invalid row ('1') or field index ('2')
[09:11:33] [WARNING] CMySQLResult::GetRowData - invalid row ('1') or field index ('3')
[09:11:33] [WARNING] CMySQLResult::GetRowData - invalid row ('1') or field index ('4')
[09:11:33] [WARNING] CMySQLResult::GetRowData - invalid row ('1') or field index ('5')
[09:11:33] [WARNING] CMySQLResult::GetRowData - invalid row ('1') or field index ('6')
[09:11:33] [WARNING] CMySQLResult::GetRowData - invalid row ('1') or field index ('7')


The problem is that even if the ban expired, It will still show me that I'm banned, unlike when I remove OR `IP Address`='127.0.0.1'

And when I remove it, i don't get these errors
Also, when I manually use that query in phpmyadmin, it's resulting in 0 rows, unlike when I remove " OR `IP Address`='127.0.0.1' " as I said
Reply
#6

Remove the spaces from field names, also show the full mysql log where the query actually executes.
Reply
#7

PHP код:
mysql_format(Databasequerysizeof(query), "SELECT * FROM `BanData` WHERE `ExpiresOn` > NOW() AND `User`='%s' OR `IPAddress`='%s'"GetName(playerid), Player_IP[playerid]);
mysql_tquery(Databasequery"OnAccountBanCheck""d"playerid); 
I removed the spaces.
Even if the ban has expired, it's resulting in 1 row..
ExpiresOn is DATETIME
I'll repeat, if I remove OR `IPAddress`='%s', everything works fine..
Reply
#8

bump!
Reply
#9

bump
Reply
#10

pawn Код:
"SELECT * FROM `BanData` WHERE `ExpiresOn` > NOW() AND (`User`='%s' OR `IPAddress`='%s')"
?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)