31.07.2018, 08:18
If you have a separate table for phone numbers:
or in the same table use UPDATE query but set phone number column as UNIQUE KEY.
To either of the two, set a callback in mysql_tquery and then check affected rows: https://sampwiki.blast.hk/wiki/MySQL#cache_affected_rows
If it inserts a new record or updates a record, it will affect 1 row. If it is 0, a mobile already exists so return an error to the player.
pawn Код:
INSERT IGNORE INTO ... (...) VALUES (...)
pawn Код:
UPDATE IGNORE SET ..
If it inserts a new record or updates a record, it will affect 1 row. If it is 0, a mobile already exists so return an error to the player.