SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 02/01/2012, 08:49 PM   #1
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,793
Reputation: 1179
Default How to make this query non-case sensitive?

Hi all, I have this query where my OnPlayerConnect is to catch whether the player is registered though the only problem with it is that it's case sensitive which I don't really want to use.

I've already have about 3,000 player's registered in 2 days, it'd be a total nightmare to destroy their work put into the server I have...

pawn Code:
format( Query, sizeof( Query ), "SELECT `NAME` FROM `USERS` WHERE `NAME` = '%s'", DB_Escape( name ) );
Result = db_query( Database, Query );

I'm not sure how to do this though, asking for help here. MYSQL doesn't be a bitch like SQLite does, so i'm wondering if anyone has a answer to this.

Just to make sure no-one gets confused about my using my mysql query:
pawn Code:
format(query, sizeof(query), "SELECT * FROM `player_data` WHERE NAME = '%s' LIMIT 0,1", ReturnPlayerName(playerid));
mysql_query(query);

Probably a less efficient option there ^^
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline   Reply With Quote
Old 02/01/2012, 09:03 PM   #2
Rachael
Huge Clucker
 
Rachael's Avatar
 
Join Date: Feb 2010
Posts: 380
Reputation: 28
Default Re: How to make this query non-case sensitive?

you could try using a query like this

SELECT * FROM table WHERE UPPER(`name`) = UPPER('%s')
Rachael is offline   Reply With Quote
Old 02/01/2012, 09:05 PM   #3
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,793
Reputation: 1179
Default Re: How to make this query non-case sensitive?

Quote:
Originally Posted by Rachael View Post
you could try using a query like this

SELECT * FROM table WHERE UPPER(`name`) = UPPER('%s')
I'm currently looking @ http://stackoverflow.com/questions/9...ring-comparing

"WHERE name = 'someone' COLLATE NOCASE"

Looks like a effective way. Now all I need to do is check for any account duplicates, with some query :O

Does anyone know such a query that dumps duplicated entries?
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline   Reply With Quote
Reply

Thread Tools
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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Failed to exeute query. Lost connection to MySQL server during query. *IsBack Help Archive 10 06/01/2011 08:50 AM


All times are GMT. The time now is 11:14 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.