Mysql not inserting
#1

Hello, I am having a little problem where the mysql query isn't working, it isn't inserting into the table.

Here is the code
Код:
stock RegisterPlayer(playerid, password[])
{
    printf("ID (%i) has started stock RegisterPlayer", playerid);
    GetPlayerName(playerid, maName, sizeof(maName));
	mysql_real_escape_string(maName, escname);
	mysql_real_escape_string(password, escpass);
	format(query, sizeof(query), "INSERT INTO master_data ('Username','Password') VALUES ('%s', '%s')", escname, escpass);
	mysql_query(query);
	SCM(playerid, GREEN, "Your account was successfully created, please log in.");
	IsAccount(playerid);
	return 1;
}
Reply
#2

bump
Reply
#3

Go into the main directory and you should see mysql_logs.txt, post that here.

EDIT: Also,
Код:
format(query, sizeof(query), "INSERT INTO master_data (Username, Password) VALUES ('%s', '%s')", escname, escpass);
Reply
#4

Код:
[22:33:24] >> mysql_query( Connection handle: 1 )
 
[22:33:24] CMySQLHandler::Query(SELECT * FROM master_data WHERE Username = 'Duck') - Successfully executed.
 
[22:33:24] >> mysql_store_result( Connection handle: 1 )
 
[22:33:24] CMySQLHandler::StoreResult() - Result was stored.
 
[22:33:24] >> mysql_num_rows( Connection handle: 1 )
 
[22:33:24] CMySQLHandler::NumRows() - Returned 0 row(s)
 
[22:33:24] >> mysql_free_result( Connection handle: 1 )
 
[22:33:24] CMySQLHandler::FreeResult() - Result was successfully free'd.
 
[22:33:28] >> mysql_real_escape_string( Connection handle: 1 )
 
[22:33:28] CMySQLHandler::EscapeString(Duck); - Escaped 4 characters to Duck.
 
[22:33:28] >> mysql_real_escape_string( Connection handle: 1 )
 
[22:33:28] CMySQLHandler::EscapeString(Duck); - Escaped 4 characters to Duck.
 
[22:33:28] >> mysql_query( Connection handle: 1 )
 
[22:33:28] CMySQLHandler::Query(INSERT INTO master_data (Username, Password) VALUES ('Duck', 'Duck')) - Successfully executed.
 
[22:33:28] >> mysql_query( Connection handle: 1 )
 
[22:33:28] CMySQLHandler::Query(SELECT * FROM master_data WHERE Username = 'Duck') - Successfully executed.
 
[22:33:28] >> mysql_store_result( Connection handle: 1 )
 
[22:33:28] CMySQLHandler::StoreResult() - Result was stored.
 
[22:33:28] >> mysql_num_rows( Connection handle: 1 )
 
[22:33:28] CMySQLHandler::NumRows() - Returned 1 row(s)
 
[22:33:28] >> mysql_free_result( Connection handle: 1 )
 
[22:33:28] CMySQLHandler::FreeResult() - Result was successfully free'd.
Reply
#5

enable debugging.

mysql_debug(1); under OnGameModeInit()
Reply
#6

Quote:
Originally Posted by xXShadowXx
Посмотреть сообщение
enable debugging.

mysql_debug(1); under OnGameModeInit()
just realised, check the post above
Reply
#7

Quote:
Originally Posted by MotherDucker
Посмотреть сообщение
just realised, check the post above
Your query is fine. Have you tried executing it in phpmyadmin?
Reply
#8

Quote:
Originally Posted by xXShadowXx
Посмотреть сообщение
Your query is fine. Have you tried executing it in phpmyadmin?
Yeah, I updated the MySQL plugin, the one I had was bugged and didn't execute it properly, it works now, sorry for the inconvenience.

Rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)