Mysql check if user exists - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysql check if user exists (
/showthread.php?tid=579830)
Mysql check if user exists -
IKnowWhatIAmDoing - 30.06.2015
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?
Re: Mysql check if user exists -
Suicidal.Banana - 30.06.2015
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)
Re: Mysql check if user exists -
IKnowWhatIAmDoing - 30.06.2015
Quote:
Originally Posted by Suicidal.Banana
|
These functions are outdated for r39-2, free_result etc. these were all removed.
Which is exactly why I'm asking this question today.
Re: Mysql check if user exists -
Suicidal.Banana - 30.06.2015
derp, my bad
Re: Mysql check if user exists -
SpikeSpigel - 30.06.2015
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 !