Help with Phone Numbers
#7

Quote:
Originally Posted by GTLS
Посмотреть сообщение
What others simply meant was, Fire this query,
Код:
 SELECT pPhoneNumber from `users` where pPhoneNumber = RandNumber //or what ever your variables are.
Then, inside the threaded function, check for number of rows affected.
Код:
 cache_affected_rows()
If the number is not zero, it means the number already exists within some other player. In that case, return 0 to the function and re call the random value generation to do all this again until you find a random number.


Tip: You can save all new numbers inside a .ini file or something. Only numbers. When a player buys a new phone, get the values from that file and if none of them matches the number, assign it to new buyer.
No, I do not mean this. The whole purpose of affected rows is to avoid executing 2 queries (1 select to check if phone number exists and 1 update to set a new phone number). You execute only 1 UPDATE query and you know right away if the phone exists or updated the database without errors.

However, what I understood from ImTobi's first post if far from what he needs. So GTLS is right.
What if you try to call an offline player? What should happen?
Reply


Messages In This Thread
Help with Phone Numbers - by ImTobi - 31.07.2018, 06:13
Re: Help with Phone Numbers - by Calisthenics - 31.07.2018, 08:18
Re: Help with Phone Numbers - by ImTobi - 31.07.2018, 08:37
Re: Help with Phone Numbers - by Calisthenics - 31.07.2018, 09:10
Re: Help with Phone Numbers - by ImTobi - 01.08.2018, 04:15
Re: Help with Phone Numbers - by GTLS - 01.08.2018, 05:03
Re: Help with Phone Numbers - by Calisthenics - 01.08.2018, 07:55
Re: Help with Phone Numbers - by ImTobi - 03.08.2018, 00:00
Re: Help with Phone Numbers - by ImTobi - 03.08.2018, 00:05
Re: Help with Phone Numbers - by ImTobi - 05.08.2018, 17:34
Re: Help with Phone Numbers - by ImTobi - 09.08.2018, 09:27
Re: Help with Phone Numbers - by ImTobi - 18.08.2018, 13:26
Re: Help with Phone Numbers - by m4karow - 18.08.2018, 13:31
Re: Help with Phone Numbers - by XStormiest - 18.08.2018, 13:47
Re: Help with Phone Numbers - by Logic_ - 18.08.2018, 17:50
Re: Help with Phone Numbers - by Calisthenics - 18.08.2018, 18:35

Forum Jump:


Users browsing this thread: 1 Guest(s)