[MySQL]Need help about PhoneNumber!
#1

Hello, I've created a MySQL website for a RolePlay mode.
Everything is okay, I'm registering just fine... but one thing isn't okay.
I don't how to make a random phone number at the PHPMyAdmin... so, If player 1 has number "105050" and Player two jsut registerted, he should have number "105051", pretty much as LS:RP, please I need help!...

Thank you.
Reply
#2

Bump...
Reply
#3

The best thing to do is to generate it in pawn, as you can't create more than 1 auto incrementing field as far as I know.
Reply
#4

I know...
But, I have a MySQL server... and the details should be save, I need to know what to do.
Reply
#5

Quote:
Originally Posted by Eliran Pesahov
I know...
But, I have a MySQL server... and the details should be save, I need to know what to do.
...So create a value, and save it in MySQL. /facepalm? Do I have to write the code out for you?... despite practically explaining in lamens terms.
Reply
#6

Yes... because I'm not that good, so please give me.
And you should do /facepalm
I'm learning day, day...
Reply
#7

In PHP (or w/e) do it so its like..

You get the latest record in your database and get the phone number and +1 to it. then insert that into your db
Reply
#8

If I know how?...
That's why I opend that subject, so guys like would help me.
If you can tell me how to do it please? so, please... help.
Reply
#9

pawn Код:
new HighestNumber[ 12 ], HighestNumberInt;

mysql_query( "SELECT * FROM Users WHERE PhoneNumber = ( SELECT MAX( PhoneNumber ) FROM Users );" ); // Query for the result.

mysql_store_result(); // Store the result in memory
mysql_fetch_row_data(); // Fetch row data of the result
mysql_fetch_field( "PhoneNumber", HighestNumber ); // Fetch specific field
HighestNumberInt = strval( HighestNumber ); // This should be your highest number.
mysql_free_result(); // Free the result to avoid using excessive memory
I know it's not optimal, but I rushed it and the query could probably be executed better. Some functions may be different, depending on which plugin you use. I use StrickenKid's and I've used it for this example.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)