29.01.2011, 19:15
Database connect succesful, but it doesn't create a user.
Why not?
Thanks,,
Why not?
Thanks,,
Код:
#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; }