SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 12/06/2016, 06:16 PM   #81
WhiteGhost
Guest
 
Posts: n/a
Default Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool]

Quote:
Originally Posted by Konstantinos View Post
Code:
"INSERT INTO `accounts` (`Name`, `Password`, `IP`, `Admin`, `VIP`, `Money`) VALUES ('%e', '%e', '%e', 0, 0, 0, %f, %f, %f, %f)", playername, Player[playerid][Password], playerip
The above code has:

- 6 columns and 10 values.
- 7 specifiers and 3 arguments.

Obviously the query fails due to error in the syntax. Review the query, specify the columns you want to add values to and the values themselves. Pass the correct number of arguments for the same number of specifiers.
Same Problem,i now have
PHP Code:
            mysql_format(mysqlquerysizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `Admin`, `VIP`, `Money`) VALUES ('%e', '%e', '%e', 0, 0, 0, %f, %f, %f, %f)"playernamePlayer[playerid][Password], playerip);
            
mysql_tquery(mysqlquery"OnAccountRegister""i"playerid); 
  Reply With Quote
Old 12/06/2016, 09:36 PM   #82
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,827
Reputation: 1401
Default Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool]

It is the same. I'll show in detail what I mean:

Name -> '%e' -> playername
Password -> '%e' -> Player[playerid][Password]
IP -> '%e' -> playerip
Admin -> 0
VIP -> 0
Money -> 0

Until this part, everything is correct but take a closer look to the rest:

?? -> %f -> ??
?? -> %f -> ??
?? -> %f -> ??
?? -> %f -> ??

You have 4 specifiers that do not have columns nor arguments.
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 12/06/2016, 11:23 PM   #83
WhiteGhost
Guest
 
Posts: n/a
Default Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool]

Quote:
Originally Posted by Konstantinos View Post
It is the same. I'll show in detail what I mean:

Name -> '%e' -> playername
Password -> '%e' -> Player[playerid][Password]
IP -> '%e' -> playerip
Admin -> 0
VIP -> 0
Money -> 0

Until this part, everything is correct but take a closer look to the rest:

?? -> %f -> ??
?? -> %f -> ??
?? -> %f -> ??
?? -> %f -> ??

You have 4 specifiers that do not have columns nor arguments.
PHP Code:
  mysql_format(mysqlquerysizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `Admin`, `VIP`, `Money`) VALUES ('%e', '%e', '%e', 0, 0, 0)"playernamePlayer[playerid][Password], playerip); 
Changed it,same problem.

Edit: shouldnt
PHP Code:
OnAccountRegister 
be
PHP Code:
OnAccountCheck 
at this line:
PHP Code:
mysql_tquery(mysqlquery"OnAccountRegister""i"playerid); 

Last edited by WhiteGhost; 13/06/2016 at 12:03 AM.
  Reply With Quote
Old 13/06/2016, 12:49 AM   #84
Slawiii
Huge Clucker
 
Slawiii's Avatar
 
Join Date: May 2015
Location: Morocco, Missour
Posts: 293
Reputation: 16
Default Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool]

Nice Tuto !..
Slawiii is offline   Reply With Quote
Old 13/06/2016, 10:13 AM   #85
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,827
Reputation: 1401
Default Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool]

Quote:
Originally Posted by WhiteGhost View Post
PHP Code:
  mysql_format(mysqlquerysizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `Admin`, `VIP`, `Money`) VALUES ('%e', '%e', '%e', 0, 0, 0)"playernamePlayer[playerid][Password], playerip); 
Changed it,same problem.

Edit: shouldnt
PHP Code:
OnAccountRegister 
be
PHP Code:
OnAccountCheck 
at this line:
PHP Code:
mysql_tquery(mysqlquery"OnAccountRegister""i"playerid); 
That's a valid query. Check your mysql logs and make sure the size of "query" is enough long to store the whole text.

We have already checked if an account exists and there isn't so we force the player to register. The query inserts the new row to the table and in OnAccountRegister, you get the cache_insert_id which is the value of the id (which was set with auto increment and increases itself in every new row).
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 16/06/2016, 04:03 PM   #86
Problems
Big Clucker
 
Join Date: Sep 2013
Posts: 136
Reputation: 1
Default Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool]

I compiled and everything was going alright then i tried to register i only can register one account with ID 0 then that "OnAccountRegister" isn't called again for any other accounts and doesn't create any accounts.
Problems is offline   Reply With Quote
Old 18/06/2016, 08:55 AM   #87
AndySedeyn
High-roller
 
AndySedeyn's Avatar
 
Join Date: Feb 2014
Location: Belgium
Posts: 1,206
Reputation: 681
Default Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool]

Quote:
Originally Posted by Problems View Post
I compiled and everything was going alright then i tried to register i only can register one account with ID 0 then that "OnAccountRegister" isn't called again for any other accounts and doesn't create any accounts.
Can you post your recent MySQL log?
AndySedeyn is offline   Reply With Quote
Old 02/07/2016, 10:55 AM   #88
Ankon
Little Clucker
 
Join Date: May 2015
Posts: 37
Reputation: 0
Default Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool]

Nice tutorial friend. But for example I have a variable "gTeam" and it stores the player's team. So how should I save it to the MySQL database?
__________________
Ankon is offline   Reply With Quote
Old 30/10/2016, 05:44 AM   #89
faizal16
Little Clucker
 
Join Date: Feb 2014
Location: Bandung,Indonesia
Posts: 13
Reputation: 0
Default Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool]

I have A Problem..when failed login or exit the game in login. automatic save spawn in Blubberry farm / login camera ...when I do not succeed login Sorry, my English is bad
faizal16 is offline   Reply With Quote
Old 01/12/2016, 05:15 AM   #90
Tenka
Little Clucker
 
Tenka's Avatar
 
Join Date: Nov 2016
Location: MdpM0n8RLK
Posts: 40
Reputation: 2
Default Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool]

It's normally?

Quote:
[13:08:36 12/01/16] [DEBUG] mysql_format - connection: 1, len: 128, format: "UPDATE `accounts` SET `Money` = %d, `PosX` = %f, `PosY` = %f, `PosZ` = %f, `PosA` = %f WHERE `ID` = %d"
[13:08:36 12/01/16] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `accounts` SET `Money` = 0, `PosX` = -46.933, `PosY` = -7", callback: "(null)", format: "(null)"
[13:08:36 12/01/16] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[13:08:36 12/01/16] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 42.511 milliseconds
[13:08:36 12/01/16] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
[13:08:48 12/01/16] [DEBUG] mysql_connect - host: "localhost", user: "root", database: "server", password: "****", port: 3306, autoreconnect: true, pool_size: 2
[13:08:48 12/01/16] [DEBUG] CMySQLHandle::Create - creating new connection..
[13:08:48 12/01/16] [WARNING] CMySQLHandle::Create - connection already exists
[13:08:48 12/01/16] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[13:08:48 12/01/16] [DEBUG] CMySQLConnection::Connect - connection was successful
[13:08:48 12/01/16] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[13:08:48 12/01/16] [DEBUG] mysql_errno - connection: 1
[13:08:48 12/01/16] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[13:08:48 12/01/16] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[13:08:48 12/01/16] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[13:08:48 12/01/16] [DEBUG] CMySQLConnection::Connect - connection was successful
[13:08:48 12/01/16] [DEBUG] CMySQLConnection::Connect - connection was successful
[13:08:48 12/01/16] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT `Password`, `ID` FROM `accounts` WHERE `Name` = '%e' LIMIT 1"
[13:08:48 12/01/16] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[13:08:48 12/01/16] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
FROM `accounts` WHERE `Name` = 'Woody' L", callback: "OnAccountCheck", format: "i"
[13:08:48 12/01/16] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[13:08:48 12/01/16] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - starting query execution
[13:08:48 12/01/16] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - query was successfully executed within 0.280 milliseconds
[13:08:48 12/01/16] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[13:08:48 12/01/16] [DEBUG] Calling callback "OnAccountCheck"..
[13:08:48 12/01/16] [DEBUG] cache_get_data - connection: 1
[13:08:48 12/01/16] [DEBUG] cache_get_field_content - row: 0, field_name: "Password", connection: 1, max_len: 129
[13:08:48 12/01/16] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Password", data: "CCE08BBA3F2E3C029CD257104B06D4B075772D5F514CF1B77 89506F9A69D53C51464881D2C18445AB290553B302F67A24B1 C69E3E737A46215DEAF43517E4960"
[13:08:48 12/01/16] [DEBUG] cache_get_field_content_int - row: 0, field_name: "ID", connection: 1
[13:08:48 12/01/16] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "ID", data: "1"
[13:08:48 12/01/16] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[13:08:53 12/01/16] [DEBUG] mysql_format - connection: 1, len: 100, format: "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1"
[13:08:53 12/01/16] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `accounts` WHERE `Name` = 'Woody' LIMIT 1", callback: "OnAccountLoad", format: "i"
[13:08:53 12/01/16] [DEBUG] CMySQLQuery::Execute[OnAccountLoad] - starting query execution
[13:08:53 12/01/16] [DEBUG] CMySQLQuery::Execute[OnAccountLoad] - query was successfully executed within 0.350 milliseconds
[13:08:53 12/01/16] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[13:08:53 12/01/16] [DEBUG] Calling callback "OnAccountLoad"..
[13:08:53 12/01/16] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Admin", connection: 1
[13:08:54 12/01/16] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Admin", data: "0"
[13:08:54 12/01/16] [DEBUG] cache_get_field_content_int - row: 0, field_name: "VIP", connection: 1
[13:08:54 12/01/16] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "VIP", data: "0"
[13:08:54 12/01/16] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Money", connection: 1
[13:08:54 12/01/16] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Money", data: "0"
[13:08:54 12/01/16] [DEBUG] cache_get_field_content_float - row: 0, field_name: "PosX", connection: 1
[13:08:54 12/01/16] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "PosX", data: "-46.933"
[13:08:54 12/01/16] [DEBUG] cache_get_field_content_float - row: 0, field_name: "PosY", connection: 1
[13:08:54 12/01/16] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "PosY", data: "-7.618"
[13:08:54 12/01/16] [DEBUG] cache_get_field_content_float - row: 0, field_name: "PosZ", connection: 1
[13:08:54 12/01/16] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "PosZ", data: "3.109"
[13:08:54 12/01/16] [DEBUG] cache_get_field_content_float - row: 0, field_name: "PosA", connection: 1
[13:08:54 12/01/16] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "PosA", data: "325.763"
[13:08:54 12/01/16] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
Tenka is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] MySQL Registration System [Threaded Queries(R33+) + Whirlpool] newbienoob Tutorials 167 06/01/2020 11:16 AM
[Tutorial] MySQL Threaded queries with y_inline Jay_ Tutorials 20 22/01/2017 06:03 PM
MySQL Help - Threaded Queries. Lynn Scripting Help 3 09/01/2015 07:44 PM
[Tutorial] Using MySQL R39 with Threaded Queries and Password Salting. Chillstep Tutorials 3 19/06/2014 04:40 PM
MySQL Threaded Queries CONTROLA Scripting Help 4 25/11/2012 03:02 PM


All times are GMT. The time now is 01:12 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.