SA-MP Forums Archive
MySQL how to check does information 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 how to check does information exists (/showthread.php?tid=548685)



MySQL how to check does information exists - Delgad0 - 01.12.2014

Hello. I'm making MySQL register and login system. I made, that, if player is registering he have to enter his email and I don't know how to check, does that email which he entered exists in MySQL database.
Maybe someone can help me?
Thanks!


Re : MySQL how to check does information exists - Dutheil - 01.12.2014

What version of MySQL are you using ?


Re: Re : MySQL how to check does information exists - Delgad0 - 01.12.2014

Quote:
Originally Posted by Dutheil
Посмотреть сообщение
What version of MySQL are you using ?
R7


Re : MySQL how to check does information exists - Dutheil - 01.12.2014

Use that function : mysql_num_rows()


Re: Re : MySQL how to check does information exists - Delgad0 - 01.12.2014

Quote:
Originally Posted by Dutheil
Посмотреть сообщение
Use that function : mysql_num_rows()
Humm.. But how should I check?

Could you give example? I'll give you +rep


Re: MySQL how to check does information exists - Vince - 01.12.2014

Put a unique key on the e-mail address column. Then just insert. If it comes back with a duplicate key error (catch in OnQueryError) you can just handle it there. Saves you one select query.