MySQL data
#5

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
`SELECT * FROM table_name` will fetch ANY column. Do not use this unless you want to retrieve everything for a player.

There is `COUNT` aggregate function which returns a 0/1 in your case.

You still execute 2 queries to check and update. All this can be done in 1 query using the keyword `IGNORE` and affected rows. Set the column for username as UNIQUE KEY and then execute your update query:
pawn Код:
UPDATE IGNORE table_name SET ...
after executing the query, check how many rows were affected. If it is 0, this means there is a player with this name and hid the warning (for duplicate) as it was instructed to (by the keyword `IGNORE`). If the affected rows is 1, it updated the new name.
Thanks, and how do I send a message to the player warning that it did not work?
Reply


Messages In This Thread
MySQL data - by Electrifying - 02.10.2018, 17:50
Re: MySQL data - by DAKYSKYE - 02.10.2018, 18:28
Re: MySQL data - by Calisthenics - 02.10.2018, 18:50
Re: MySQL data - by Electrifying - 02.10.2018, 18:53
Re: MySQL data - by Electrifying - 02.10.2018, 19:00
Re: MySQL data - by Electrifying - 02.10.2018, 20:43
Re: MySQL data - by NativeZ - 03.10.2018, 17:18

Forum Jump:


Users browsing this thread: 1 Guest(s)