MYSQL EXIST
#1

need help with if mysql account exist

Help me please
Reply
#2

do a select and check if the rowcount is 0
Reply
#3

How to please
Reply
#4

It depends on your sql structure. But it should be something like
PHP код:
select `idfrom `accountswhere `name` = 'itachi'
or just
PHP код:
select count(*) from `accountswhere `name` = 'itachi'
Reply
#5

IF NOT ACCOUNT EXIST

Quote:

new query[64+MAX_PLAYER_NAME];
mysql_format(handle, query, sizeof(query), "INSERT INTO `TEST` (nick, hodnost, LOG) VALUES ('%s', 0, 0)", Meno(playerid));
mysql_query(handle, query);

IF ACCOUNTE EXIST

Quote:

new query[64+MAX_PLAYER_NAME];
mysql_format(handle, query, sizeof(query), "UPDATE `ASystem` SET LOG=1 WHERE nick='%s'", Meno(playerid));
mysql_query(handle, query);
mysql_format(handle, query, sizeof(query), "SELECT * FROM `TEST` WHERE nick = '%s'", Meno(playerid));
mysql_query(handle, query);

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)