SA-MP Forums Archive
[MySQL]Need help about PhoneNumber! - 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]Need help about PhoneNumber! (/showthread.php?tid=142646)



[MySQL]Need help about PhoneNumber! - Eliran Pesahov - 19.04.2010

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.


Re: [MySQL]Need help about PhoneNumber! - Eliran Pesahov - 20.04.2010

Bump...


Re: [MySQL]Need help about PhoneNumber! - Calgon - 20.04.2010

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.


Re: [MySQL]Need help about PhoneNumber! - Eliran Pesahov - 20.04.2010

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


Re: [MySQL]Need help about PhoneNumber! - Calgon - 20.04.2010

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.


Re: [MySQL]Need help about PhoneNumber! - Eliran Pesahov - 20.04.2010

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


Re: [MySQL]Need help about PhoneNumber! - DarrenReeder - 20.04.2010

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


Re: [MySQL]Need help about PhoneNumber! - Eliran Pesahov - 20.04.2010

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.


Re: [MySQL]Need help about PhoneNumber! - Calgon - 20.04.2010

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.