#include <a_samp> #include <a_mysql> #define SQL_HOST "localhost" #define SQL_USER "USamp" #define SQL_PASS "PSamp" #define SQL_DB "MLSamp" main() { } public OnGameModeInit() { SetGameModeText("Blank Script"); if(!mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS)) { print("SQL connection attempt 1 FAILED!"); if(!mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS)) { print("SQL connection attempt 2 FAILED!"); if(!mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS)) { print("SQL connection attempt 3 FAILED!"); return 1; } } }else{ print("SQL connection succes!"); new PlayerName[50], password[50]; new Query[200]; format(PlayerName, 50, "Harry"); format(password, 50, "MijnPassword"); new escpname[50], escpass[50]; mysql_real_escape_string(PlayerName, escpass); mysql_real_escape_string(password, escpname); format(Query, sizeof(Query), "INSERT INTO `users` (`username`, `password`) VALUES ('%s', '%s')", escpname, escpass); mysql_query(Query); mysql_free_result(); mysql_error(); } return 1; } public OnGameModeExit() { return 1; }
[13:35:23] >> mysql_connect( ) [13:35:23] CMySQLHandler::CMySQLHandler() - constructor called. [13:35:23] CMySQLHandler::CMySQLHandler() - Connecting to "tom-roelofs.nl" | DB: "MLSamp" | Username: "USamp" ... [13:35:23] CMySQLHandler::Connect() - Host 'here my ip.ip.telfort.nl' is not allowed to connect to this MySQL server (Error ID: 1130) [13:35:23] >> mysql_real_escape_string( Connection handle: 1 ) |