Mysql check if user exists
#1

Hello,

I want to know how can I check if a user exists at the mysql db or not.

table name = players
player name column = username
mysql plugin version: r39-2

I want to have a function which I can use like

if(!DoesUserExist(name)) return SendClientMessage(playerid,"No user was found.");

Can anyone help me please?
Reply
#2

https://sampwiki.blast.hk/wiki/MySQL#mysql_num_rows
if 0, no user was found, see example code on the above link
(do a select query to fetch user, then do the mysql_num_rows on the result of that query)
Reply
#3

Quote:
Originally Posted by Suicidal.Banana
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/MySQL#mysql_num_rows
if 0, no user was found, see example code on the above link
(do a select query to fetch user, then do the mysql_num_rows on the result of that query)
These functions are outdated for r39-2, free_result etc. these were all removed.

Which is exactly why I'm asking this question today.
Reply
#4

derp, my bad
Reply
#5

I do something like this . I have an UCP and player need to register on it first, I accept/refuse their accounts and then when they connect to the server my MySQL data base works like this.
SELECT * from 'USERID' and SELECT * from 'Accepted' = 1 . You can do the same !
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)