SA-MP Forums Archive
MYSQL question - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MYSQL question (/showthread.php?tid=198120)



MYSQL question - ajwar - 11.12.2010

How to check if the name is already registered?


Re: MYSQL question - Calgon - 11.12.2010

Perform a select query with a where clause of their username, then use mysql_num_rows to check how many rows were returned.

pawn Код:
mysql_query("SELECT username FROM users WHERE username = 'Calgon'");
mysql_store_result();
if(mysql_num_rows() > 0) {
// User exists
}
else {
// User does not exist
}
mysql_free_result();