SA-MP Forums Archive
MySQL problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL problem (/showthread.php?tid=651164)



MySQL problem - C5Perfect - 15.03.2018

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?


Re: MySQL problem - DobbysGamertag - 15.03.2018

Why have you got spaces in your column names?


Re: MySQL problem - C5Perfect - 15.03.2018

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


Re: MySQL problem - FailerZ - 15.03.2018

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


Re: MySQL problem - C5Perfect - 15.03.2018

[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


Re: MySQL problem - iKarim - 15.03.2018

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


Re: MySQL problem - C5Perfect - 16.03.2018

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..


Re: MySQL problem - kovac - 18.03.2018

bump!


Re: MySQL problem - kovac - 19.03.2018

bump


Re: MySQL problem - Jefff - 20.03.2018

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